BUG-2218: Keep existing link augmentations during discovery process
[controller.git] / opendaylight / sal / api / src / main / java / org / opendaylight / controller / sal / core / Capabilities.java
index b239ed4739cafce8d5137f641739f7c04e0adf85..147f1b13aedc32e6c3f50ebdf5badcaca010a85b 100644 (file)
@@ -9,13 +9,11 @@
 
 package org.opendaylight.controller.sal.core;
 
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-
 /**
  * @file   Capabilities.java
  *
@@ -24,29 +22,30 @@ import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
  * Describes supported capabilities
  */
 @XmlRootElement
+@XmlAccessorType(XmlAccessType.NONE)
 public class Capabilities extends Property {
-       private static final long serialVersionUID = 1L;
-    @XmlElement
+        private static final long serialVersionUID = 1L;
+    @XmlElement(name="value")
     private int capabilitiesValue;
-    
-    public enum CapabilitiesType { 
-       FLOW_STATS_CAPABILITY(1<<0),
-       TABLE_STATS_CAPABILITY(1<<1),
-       PORT_STATS_CAPABILITY(1<<2),
-       STP_CAPABILITY(1<<3),
-       RSVD_CAPABILITY(1<<4),
-       IP_REASSEM_CAPABILITY(1<<5),
-       QUEUE_STATS_CAPABILITY(1<<6),
-       ARP_MATCH_IP_CAPABILITY(1<<7);
-       private final int ct;
-       CapabilitiesType(int val) {
-               this.ct = val;
-       }
-       public int getValue() {
-               return ct;
-       }
+
+    public enum CapabilitiesType {
+        FLOW_STATS_CAPABILITY(1<<0),
+        TABLE_STATS_CAPABILITY(1<<1),
+        PORT_STATS_CAPABILITY(1<<2),
+        STP_CAPABILITY(1<<3),
+        RSVD_CAPABILITY(1<<4),
+        IP_REASSEM_CAPABILITY(1<<5),
+        QUEUE_STATS_CAPABILITY(1<<6),
+        ARP_MATCH_IP_CAPABILITY(1<<7);
+        private final int ct;
+        CapabilitiesType(int val) {
+                this.ct = val;
+        }
+        public int getValue() {
+                return ct;
+        }
     }
-   
+
     public static final String CapabilitiesPropName = "capabilities";
     /**
      * Construct a Capabilities property
@@ -67,26 +66,44 @@ public class Capabilities extends Property {
         this.capabilitiesValue = 0;
     }
 
+    @Override
     public Capabilities clone() {
         return new Capabilities(this.capabilitiesValue);
     }
 
     public int getValue() {
-       return this.capabilitiesValue;
+        return this.capabilitiesValue;
     }
-    
+
     @Override
     public int hashCode() {
-        return HashCodeBuilder.reflectionHashCode(this);
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + capabilitiesValue;
+        return result;
     }
 
     @Override
     public boolean equals(Object obj) {
-        return EqualsBuilder.reflectionEquals(this, obj);
+        if (this == obj)
+            return true;
+        if (!super.equals(obj))
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        Capabilities other = (Capabilities) obj;
+        if (capabilitiesValue != other.capabilitiesValue)
+            return false;
+        return true;
     }
 
     @Override
     public String toString() {
-        return "Capabilities[" + ReflectionToStringBuilder.toString(this) + "]";
+        return "Capabilities[" + capabilitiesValue + "]";
+    }
+
+    @Override
+    public String getStringValue() {
+        return Integer.toHexString(capabilitiesValue);
     }
 }