blob: 6fe7067d29ce53591db42809a033f6a20796efad [file] [log] [blame]
Thomas Vachuska58de4162015-09-10 16:15:33 -07001/*
2 * Copyright 2015 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Brian O'Connor6de2e202015-05-21 14:30:41 -070016package org.onosproject.incubator.net.resource.label;
17
Brian O'Connor893b9222015-06-25 15:07:04 -040018import com.google.common.annotations.Beta;
Brian O'Connor6de2e202015-05-21 14:30:41 -070019import org.onosproject.net.resource.ResourceId;
jccfff0de92015-03-28 01:40:08 -070020
21import java.util.Objects;
22
23/**
24 * Representation of a label.
25 */
Brian O'Connor893b9222015-06-25 15:07:04 -040026@Beta
jccfff0de92015-03-28 01:40:08 -070027public final class LabelResourceId implements ResourceId {
28
29 private long labelId;
30
31 public static LabelResourceId labelResourceId(long labelResourceId) {
32 return new LabelResourceId(labelResourceId);
33 }
34
35 // Public construction is prohibited
36 private LabelResourceId(long labelId) {
37 this.labelId = labelId;
38 }
39
40 public long labelId() {
41 return labelId;
42 }
43
44 @Override
45 public int hashCode() {
46 return Objects.hashCode(labelId);
47 }
48
49 @Override
50 public boolean equals(Object obj) {
51 if (obj instanceof LabelResourceId) {
52 LabelResourceId that = (LabelResourceId) obj;
53 return Objects.equals(this.labelId, that.labelId);
54 }
55 return false;
56 }
57
58 @Override
59 public String toString() {
60 return String.valueOf(this.labelId);
61 }
62
63}