8936954a56f7671c92a56abc76c5a63db69e429a
[onosfw.git] /
1 package org.onosproject.incubator.net.resource.label;
2
3 import com.google.common.annotations.Beta;
4 import org.onosproject.net.resource.ResourceId;
5
6 import java.util.Objects;
7
8 /**
9  * Representation of a label.
10  */
11 @Beta
12 public final class LabelResourceId implements ResourceId {
13
14     private long labelId;
15
16     public static LabelResourceId labelResourceId(long labelResourceId) {
17         return new LabelResourceId(labelResourceId);
18     }
19
20     // Public construction is prohibited
21     private LabelResourceId(long labelId) {
22         this.labelId = labelId;
23     }
24
25     public long labelId() {
26         return labelId;
27     }
28
29     @Override
30     public int hashCode() {
31         return Objects.hashCode(labelId);
32     }
33
34     @Override
35     public boolean equals(Object obj) {
36         if (obj instanceof LabelResourceId) {
37             LabelResourceId that = (LabelResourceId) obj;
38             return Objects.equals(this.labelId, that.labelId);
39         }
40         return false;
41     }
42
43     @Override
44     public String toString() {
45         return String.valueOf(this.labelId);
46     }
47
48 }