Cosmetic fixes to ID classes.
Removed hand crafted hashCode, etc.
Change-Id: Ifc0d6f616988f78e5567e2cc5d4e5e535d49e1f9
diff --git a/src/main/java/net/onrc/onos/core/util/SwitchPort.java b/src/main/java/net/onrc/onos/core/util/SwitchPort.java
index 74f0ed4..da60cbf 100644
--- a/src/main/java/net/onrc/onos/core/util/SwitchPort.java
+++ b/src/main/java/net/onrc/onos/core/util/SwitchPort.java
@@ -2,6 +2,10 @@
import static com.google.common.base.Preconditions.checkNotNull;
+import java.util.Objects;
+
+import javax.annotation.concurrent.Immutable;
+
import net.onrc.onos.core.util.serializers.SwitchPortSerializer;
import org.codehaus.jackson.map.annotate.JsonSerialize;
@@ -11,6 +15,7 @@
* This class is immutable.
*/
@JsonSerialize(using = SwitchPortSerializer.class)
+@Immutable
public final class SwitchPort {
private final Dpid dpid; // The DPID of the switch
private final PortNumber port; // The port number on the switch
@@ -101,9 +106,6 @@
@Override
public int hashCode() {
- int hash = 17;
- hash += 31 * hash + dpid.hashCode();
- hash += 31 * hash + port.hashCode();
- return hash;
+ return Objects.hash(dpid, port);
}
}