[ONOS-4014] Refactor *Id classes to extend from Identifier class
- Refactor most of *Id classes in onos-api package
- Refactor all of *Id classes in incubator package
Change-Id: Ief6322d3fb42c80e82f695e9d4dcee439346215b
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainId.java b/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainId.java
index 554702a..5b3248c 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainId.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainId.java
@@ -16,8 +16,7 @@
package org.onosproject.incubator.net.domain;
import com.google.common.annotations.Beta;
-
-import java.util.Objects;
+import org.onlab.util.Identifier;
import static com.google.common.base.Preconditions.checkNotNull;
@@ -25,10 +24,7 @@
* Intent domain identifier.
*/
@Beta
-public class IntentDomainId {
-
- private final String id;
-
+public class IntentDomainId extends Identifier<String> {
/**
* Creates an intent domain identifier from the specified string representation.
*
@@ -43,7 +39,7 @@
* Constructor for serializer.
*/
IntentDomainId() {
- this.id = null;
+ super(null);
}
/**
@@ -52,28 +48,6 @@
* @param value the underlying value of this ID
*/
IntentDomainId(String value) {
- this.id = checkNotNull(value, "Intent domain ID cannot be null.");
- }
-
- @Override
- public int hashCode() {
- return id.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if (!(obj instanceof IntentDomainId)) {
- return false;
- }
- IntentDomainId that = (IntentDomainId) obj;
- return Objects.equals(this.id, that.id);
- }
-
- @Override
- public String toString() {
- return id;
+ super(checkNotNull(value, "Intent domain ID cannot be null."));
}
}