1 package org.onosproject.incubator.net.resource.label;
3 import java.util.Objects;
5 import com.google.common.annotations.Beta;
6 import org.onosproject.net.Annotations;
7 import org.onosproject.net.DeviceId;
8 import org.onosproject.net.provider.ProviderId;
9 import static com.google.common.base.MoreObjects.toStringHelper;
12 * the implementation of a label resource of a device.
15 public final class DefaultLabelResource implements LabelResource {
17 private DeviceId deviceId;
19 private LabelResourceId labelResourceId;
22 * Initialize a label resource object.
23 * @param deviceId device identifier
24 * @param labelResourceId label resource id
26 public DefaultLabelResource(String deviceId, long labelResourceId) {
27 this.deviceId = DeviceId.deviceId(deviceId);
28 this.labelResourceId = LabelResourceId.labelResourceId(labelResourceId);
32 * Initialize a label resource object.
33 * @param deviceId device identifier
34 * @param labelResourceId label resource id
36 public DefaultLabelResource(DeviceId deviceId,
37 LabelResourceId labelResourceId) {
38 this.deviceId = deviceId;
39 this.labelResourceId = labelResourceId;
43 public DeviceId deviceId() {
48 public LabelResourceId labelResourceId() {
49 return labelResourceId;
53 public Annotations annotations() {
58 public ProviderId providerId() {
63 public int hashCode() {
64 return Objects.hash(deviceId, labelResourceId);
68 public boolean equals(Object obj) {
69 if (obj instanceof DefaultLabelResource) {
70 DefaultLabelResource that = (DefaultLabelResource) obj;
71 return Objects.equals(this.deviceId, that.deviceId)
72 && Objects.equals(this.labelResourceId,
73 that.labelResourceId);
79 public String toString() {
80 return toStringHelper(this).add("deviceId", deviceId)
81 .add("labelResourceId", labelResourceId).toString();