Merge "Prevent ConfigPusher from killing its thread"
[controller.git] / opendaylight / sal / api / src / main / java / org / opendaylight / controller / sal / core / State.java
index ba67e0d8213454e76d3fc8fc9760177745e0bec9..d74f7183deeac4c88cb822df21c3547d1c78e00d 100644 (file)
@@ -9,6 +9,8 @@
 
 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;
 
@@ -18,9 +20,10 @@ import javax.xml.bind.annotation.XmlRootElement;
  *
  */
 @XmlRootElement
+@XmlAccessorType(XmlAccessType.NONE)
 @SuppressWarnings("serial")
 public class State extends Property {
-    @XmlElement
+    @XmlElement(name="value")
     private short stateValue;
 
     public static final short EDGE_DOWN = 0;
@@ -41,6 +44,7 @@ public class State extends Property {
         this.stateValue = state;
     }
 
+    @Override
     public State clone() {
         return new State(this.stateValue);
     }
@@ -75,4 +79,17 @@ public class State extends Property {
     public String toString() {
         return "State[" + stateValue + "]";
     }
+
+    @Override
+    public String getStringValue() {
+        if (stateValue == 0) {
+            return ("EDGE_DOWN");
+        } else if (stateValue == 1) {
+            return ("EDGE_UP");
+        } else if (stateValue == 0x7fff) {
+            return ("EDGE_UNK");
+        } else {
+            return String.valueOf(stateValue);
+        }
+    }
 }