Make sure invokeOperation is set once
[controller.git] / opendaylight / adsal / sal / api / src / main / java / org / opendaylight / controller / sal / core / Capabilities.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
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
8  */
9
10 package org.opendaylight.controller.sal.core;
11
12 import javax.xml.bind.annotation.XmlAccessType;
13 import javax.xml.bind.annotation.XmlAccessorType;
14 import javax.xml.bind.annotation.XmlElement;
15 import javax.xml.bind.annotation.XmlRootElement;
16
17 /**
18  * @file   Capabilities.java
19  *
20  * @brief  Class representing capabilities
21  *
22  * Describes supported capabilities
23  */
24 @XmlRootElement
25 @XmlAccessorType(XmlAccessType.NONE)
26 @Deprecated
27 public class Capabilities extends Property {
28         private static final long serialVersionUID = 1L;
29     @XmlElement(name="value")
30     private int capabilitiesValue;
31
32     public enum CapabilitiesType {
33         FLOW_STATS_CAPABILITY(1<<0),
34         TABLE_STATS_CAPABILITY(1<<1),
35         PORT_STATS_CAPABILITY(1<<2),
36         STP_CAPABILITY(1<<3),
37         RSVD_CAPABILITY(1<<4),
38         IP_REASSEM_CAPABILITY(1<<5),
39         QUEUE_STATS_CAPABILITY(1<<6),
40         ARP_MATCH_IP_CAPABILITY(1<<7);
41         private final int ct;
42         CapabilitiesType(int val) {
43                 this.ct = val;
44         }
45         public int getValue() {
46                 return ct;
47         }
48     }
49
50     public static final String CapabilitiesPropName = "capabilities";
51     /**
52      * Construct a Capabilities property
53      *
54      * @param capabilities the Capabilities value
55      * @return Constructed object
56      */
57     public Capabilities(int capabilities) {
58         super(CapabilitiesPropName);
59         this.capabilitiesValue = capabilities;
60     }
61
62     /*
63      * Private constructor used for JAXB mapping
64      */
65     private Capabilities() {
66         super(CapabilitiesPropName);
67         this.capabilitiesValue = 0;
68     }
69
70     @Override
71     public Capabilities clone() {
72         return new Capabilities(this.capabilitiesValue);
73     }
74
75     public int getValue() {
76         return this.capabilitiesValue;
77     }
78
79     @Override
80     public int hashCode() {
81         final int prime = 31;
82         int result = super.hashCode();
83         result = prime * result + capabilitiesValue;
84         return result;
85     }
86
87     @Override
88     public boolean equals(Object obj) {
89         if (this == obj)
90             return true;
91         if (!super.equals(obj))
92             return false;
93         if (getClass() != obj.getClass())
94             return false;
95         Capabilities other = (Capabilities) obj;
96         if (capabilitiesValue != other.capabilitiesValue)
97             return false;
98         return true;
99     }
100
101     @Override
102     public String toString() {
103         return "Capabilities[" + capabilitiesValue + "]";
104     }
105
106     @Override
107     public String getStringValue() {
108         return Integer.toHexString(capabilitiesValue);
109     }
110 }