[ONOS-4014] Refactor *Id classes to extend from Identifier class
- Refactor all of *Id classes in apps package
Change-Id: I31fafbf7f15aee3a1b3b37b7c281b3f99eae0883
diff --git a/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairId.java b/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairId.java
index 1f45e80..9a2ad9a 100644
--- a/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairId.java
+++ b/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairId.java
@@ -15,27 +15,23 @@
*/
package org.onosproject.vtnrsc;
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
+import org.onlab.util.Identifier;
import java.util.UUID;
-import java.util.Objects;
+
+import static com.google.common.base.Preconditions.checkNotNull;
/**
* Representation of a Port Pair ID.
*/
-public final class PortPairId {
-
- private final UUID portPairId;
-
+public final class PortPairId extends Identifier<UUID> {
/**
* Private constructor for port pair id.
*
* @param id UUID id of port pair
*/
private PortPairId(UUID id) {
- checkNotNull(id, "Port chain id can not be null");
- this.portPairId = id;
+ super(checkNotNull(id, "Port chain id can not be null"));
}
/**
@@ -64,30 +60,6 @@
* @return port pair id
*/
public UUID value() {
- return portPairId;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof PortPairId) {
- final PortPairId other = (PortPairId) obj;
- return Objects.equals(this.portPairId, other.portPairId);
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(this.portPairId);
- }
-
- @Override
- public String toString() {
- return toStringHelper(this)
- .add("portPairId", portPairId)
- .toString();
+ return identifier;
}
}