initial import
Change-Id: Ief25aef0066ea96bd2c329ccef974c072b3a5a73
diff --git a/of/ctl/src/main/java/net/onrc/onos/of/ctl/util/InstanceId.java b/of/ctl/src/main/java/net/onrc/onos/of/ctl/util/InstanceId.java
new file mode 100644
index 0000000..861dec6
--- /dev/null
+++ b/of/ctl/src/main/java/net/onrc/onos/of/ctl/util/InstanceId.java
@@ -0,0 +1,47 @@
+package net.onrc.onos.of.ctl.util;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkArgument;
+
+/**
+ * The class representing an ONOS Instance ID.
+ *
+ * This class is immutable.
+ */
+public final class InstanceId {
+ private final String id;
+
+ /**
+ * Constructor from a string value.
+ *
+ * @param id the value to use.
+ */
+ public InstanceId(String id) {
+ this.id = checkNotNull(id);
+ checkArgument(!id.isEmpty(), "Empty ONOS Instance ID");
+ }
+
+ @Override
+ public int hashCode() {
+ return id.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+
+ if (!(obj instanceof InstanceId)) {
+ return false;
+ }
+
+ InstanceId that = (InstanceId) obj;
+ return this.id.equals(that.id);
+ }
+
+ @Override
+ public String toString() {
+ return id;
+ }
+}