[ONOS-4014] Refactor *Id classes to extend from Identifier class
- Refactor all of *Id classes in apps package
Change-Id: I31fafbf7f15aee3a1b3b37b7c281b3f99eae0883
diff --git a/src/main/java/org/onosproject/cordvtn/CordServiceId.java b/src/main/java/org/onosproject/cordvtn/CordServiceId.java
index c8f1176..32bd3c7 100644
--- a/src/main/java/org/onosproject/cordvtn/CordServiceId.java
+++ b/src/main/java/org/onosproject/cordvtn/CordServiceId.java
@@ -15,26 +15,21 @@
*/
package org.onosproject.cordvtn;
-import com.google.common.base.MoreObjects;
-
-import java.util.Objects;
+import org.onlab.util.Identifier;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Representation of service identifier.
*/
-public final class CordServiceId {
-
- private final String id;
-
+public final class CordServiceId extends Identifier<String> {
/**
* Default constructor.
*
* @param id service identifier
*/
private CordServiceId(String id) {
- this.id = id;
+ super(id);
}
/**
@@ -47,37 +42,4 @@
checkNotNull(id);
return new CordServiceId(id);
}
-
- /**
- * Returns service identifier.
- *
- * @return service id
- */
- public String id() {
- return id;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof CordServiceId)) {
- return false;
- }
- final CordServiceId other = (CordServiceId) obj;
- return Objects.equals(this.id, other.id);
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("id", id)
- .toString();
- }
}