Use Dpid class to represent DPID instead of Long for type safety
- Signatures of public methods are not changed
- Only private fields are changed to keep compatibility
Change-Id: I1d54fa54ede9b09439944cfb5f53564ff22ac339
diff --git a/src/main/java/net/onrc/onos/core/topology/SwitchImpl.java b/src/main/java/net/onrc/onos/core/topology/SwitchImpl.java
index 5d287a8..ee0eebd 100644
--- a/src/main/java/net/onrc/onos/core/topology/SwitchImpl.java
+++ b/src/main/java/net/onrc/onos/core/topology/SwitchImpl.java
@@ -1,5 +1,7 @@
package net.onrc.onos.core.topology;
+import net.onrc.onos.core.util.Dpid;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -18,12 +20,16 @@
*/
public class SwitchImpl extends TopologyObject implements Switch {
- private Long dpid;
+ private Dpid dpid;
// These needs to be ConcurrentCollecton if allowing the topology to be
// accessed concurrently
private final Map<Long, Port> ports;
public SwitchImpl(Topology topology, Long dpid) {
+ this(topology, new Dpid(dpid));
+ }
+
+ public SwitchImpl(Topology topology, Dpid dpid) {
super(topology);
this.dpid = dpid;
ports = new HashMap<Long, Port>();
@@ -31,7 +37,7 @@
@Override
public Long getDpid() {
- return dpid;
+ return dpid.value();
}
@Override