Initial sketch of LabelResource APIs
LabelResource subsystem will be used to manage label resources such as
MPLS labels, ... (Part of ONOS-1223)
:)
Change-Id: Ib11eac84d81d7d86eaaf0222cf0bd7d3c64d2e51
diff --git a/core/api/src/main/java/org/onosproject/net/resource/LabelResourceId.java b/core/api/src/main/java/org/onosproject/net/resource/LabelResourceId.java
new file mode 100644
index 0000000..f23ad6d
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/resource/LabelResourceId.java
@@ -0,0 +1,44 @@
+package org.onosproject.net.resource;
+
+import java.util.Objects;
+
+/**
+ * Representation of a label.
+ */
+public final class LabelResourceId implements ResourceId {
+
+ private long labelId;
+
+ public static LabelResourceId labelResourceId(long labelResourceId) {
+ return new LabelResourceId(labelResourceId);
+ }
+
+ // Public construction is prohibited
+ private LabelResourceId(long labelId) {
+ this.labelId = labelId;
+ }
+
+ public long labelId() {
+ return labelId;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(labelId);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof LabelResourceId) {
+ LabelResourceId that = (LabelResourceId) obj;
+ return Objects.equals(this.labelId, that.labelId);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(this.labelId);
+ }
+
+}