X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fsal%2Fapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fcore%2FState.java;h=e47542a7bef9f259bfab5ca21bbca82fc528e980;hb=c90579dcc6c893fdc4f5aebc153e8e5622c64a68;hp=4edc1f1d232b54055b70f0db0bedba83f16b0d2c;hpb=a3a28e8138fa25170b01e6b51a44490f002f6e91;p=controller.git diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/State.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/State.java index 4edc1f1d23..e47542a7be 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/State.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/State.java @@ -12,9 +12,6 @@ package org.opendaylight.controller.sal.core; 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; - /** * The class represents the State property of an Edge * @@ -23,7 +20,7 @@ import org.apache.commons.lang3.builder.HashCodeBuilder; @XmlRootElement @SuppressWarnings("serial") public class State extends Property { - @XmlElement + @XmlElement(name="value") private short stateValue; public static final short EDGE_DOWN = 0; @@ -44,6 +41,7 @@ public class State extends Property { this.stateValue = state; } + @Override public State clone() { return new State(this.stateValue); } @@ -54,16 +52,41 @@ public class State extends Property { @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + final int prime = 31; + int result = super.hashCode(); + result = prime * result + stateValue; + 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; + State other = (State) obj; + if (stateValue != other.stateValue) + return false; + return true; } @Override 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); + } + } }