X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fsal%2Fapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fcore%2FProperty.java;h=c36ac92cef0f74dac996666045d2692be7478537;hp=15d9976106f5df07c683ca37bd42d077ca970bfd;hb=bbba9ddecc8fa5835d066741328d3d812b8433b0;hpb=a3a28e8138fa25170b01e6b51a44490f002f6e91 diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Property.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Property.java index 15d9976106..c36ac92cef 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Property.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Property.java @@ -1,4 +1,3 @@ - /* * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. * @@ -11,13 +10,11 @@ package org.opendaylight.controller.sal.core; import java.io.Serializable; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSeeAlso; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ReflectionToStringBuilder; - /** * @file Property.java * @@ -29,19 +26,14 @@ import org.apache.commons.lang3.builder.ReflectionToStringBuilder; */ /** - * Abstract base class for a Property that can be attached to any sal - * core element - * + * Abstract base class for a Property that can be attached to any sal core + * element */ @XmlRootElement -@XmlSeeAlso({ Config.class, Name.class, State.class, TimeStamp.class, - Latency.class, Bandwidth.class, Tier.class, Actions.class, - AdvertisedBandwidth.class, Buffers.class, Capabilities.class, - MacAddress.class, PeerBandwidth.class, SupportedBandwidth.class, - Tables.class }) -abstract public class Property implements Serializable { +@XmlAccessorType(XmlAccessType.NONE) +abstract public class Property implements Serializable, Cloneable { private static final long serialVersionUID = 1L; - private String name; + private final String name; /** * Private constructor used for JAXB mapping @@ -59,26 +51,48 @@ abstract public class Property implements Serializable { return this.name; } + public abstract String getStringValue(); + /** * Used to copy the Property in a polymorphic way * - * * @return A clone of this Property */ - abstract public Property clone(); + @Override + public abstract Property clone(); @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + final int prime = 31; + int result = 1; + result = prime * result + ((name == null) ? 0 : name.hashCode()); + return result; } @Override public boolean equals(Object obj) { - return EqualsBuilder.reflectionEquals(this, obj); + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + Property other = (Property) obj; + if (name == null) { + if (other.name != null) { + return false; + } + } else if (!name.equals(other.name)) { + return false; + } + return true; } @Override public String toString() { - return "Property[" + ReflectionToStringBuilder.toString(this) + "]"; + return "Property [name=" + name + "]"; } }