Rooted out the last of the ReflectionToStringBuilder usage
[controller.git] / opendaylight / sal / api / src / main / java / org / opendaylight / controller / sal / packet / address / EthernetAddress.java
index 63daf2076311bce850b10f699cbd50ec8ade7a3a..6cd14eadce78c48235412f907188ce86c8b50059 100644 (file)
@@ -9,15 +9,14 @@
 
 package org.opendaylight.controller.sal.packet.address;
 
+import java.util.Arrays;
+
 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 javax.xml.bind.annotation.XmlTransient;
 
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
 import org.opendaylight.controller.sal.core.ConstructionException;
 import org.opendaylight.controller.sal.utils.HexEncode;
 
@@ -95,17 +94,29 @@ public class EthernetAddress extends DataLinkAddress {
 
     @Override
     public int hashCode() {
-        return HashCodeBuilder.reflectionHashCode(this);
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + Arrays.hashCode(macAddress);
+        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;
+        EthernetAddress other = (EthernetAddress) obj;
+        if (!Arrays.equals(macAddress, other.macAddress))
+            return false;
+        return true;
     }
 
     @Override
     public String toString() {
-        return "EthernetAddress[" + ReflectionToStringBuilder.toString(this)
+        return "EthernetAddress [macAddress=" + HexEncode.bytesToHexStringFormat(macAddress)
                 + "]";
     }