3 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
10 package org.opendaylight.controller.sal.authorization;
12 import java.io.Serializable;
14 import org.apache.commons.lang3.builder.EqualsBuilder;
15 import org.apache.commons.lang3.builder.HashCodeBuilder;
18 * It represents the elementary resource along with
19 * the access privilege associated to it
21 public class Resource implements Serializable {
22 private static final long serialVersionUID = 1L;
23 Object resource; // the generic resource
24 Privilege privilege; // read/use/write privilege
26 public Resource(Object resource, Privilege privilege) {
27 this.resource = resource;
28 this.privilege = privilege;
31 public Object getResource() {
35 public Privilege getPrivilege() {
40 public int hashCode() {
41 return HashCodeBuilder.reflectionHashCode(this);
45 public boolean equals(Object obj) {
46 return EqualsBuilder.reflectionEquals(this, obj);
50 public String toString() {
51 return "[" + resource + ", " + privilege.toString() + "]";