aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceId.java
blob: 8936954a56f7671c92a56abc76c5a63db69e429a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package org.onosproject.incubator.net.resource.label;

import com.google.common.annotations.Beta;
import org.onosproject.net.resource.ResourceId;

import java.util.Objects;

/**
 * Representation of a label.
 */
@Beta
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);
    }

}