1 package org.onosproject.incubator.net.resource.label;
3 import java.util.Collection;
4 import java.util.Objects;
6 import com.google.common.annotations.Beta;
7 import org.onosproject.net.DeviceId;
9 import com.google.common.base.MoreObjects;
10 import com.google.common.collect.ImmutableSet;
13 * Represents for a label request.
16 public class LabelResourceRequest {
18 private final DeviceId deviceId;
19 private final Type type;
20 private final long applyNum;
21 private ImmutableSet<LabelResource> releaseCollection;
24 * Creates LabelResourceRequest object.
25 * @param deviceId device identifier
26 * @param type request type
27 * @param applyNum apply the number of labels
28 * @param releaseCollection Set of released label
30 public LabelResourceRequest(DeviceId deviceId,
33 ImmutableSet<LabelResource> releaseCollection) {
34 this.deviceId = deviceId;
36 this.applyNum = applyNum;
37 this.releaseCollection = releaseCollection;
40 * Returns a device id.
43 public DeviceId deviceId() {
48 * Returns request type.
56 * Returns apply label number.
57 * @return label number
59 public long applyNum() {
64 * Returns the collection of release labels.
65 * @return Collection of DefaultLabelResource
67 public Collection<LabelResource> releaseCollection() {
68 return releaseCollection;
75 APPLY, //apple label request
76 RELEASE //release label request
80 public int hashCode() {
81 return Objects.hash(this.deviceId, this.applyNum, this.type,
82 this.releaseCollection);
86 public boolean equals(Object obj) {
87 if (obj instanceof LabelResourceRequest) {
88 LabelResourceRequest that = (LabelResourceRequest) obj;
89 return Objects.equals(this.deviceId, that.deviceId)
90 && Objects.equals(this.applyNum, that.applyNum)
91 && Objects.equals(this.type, that.type)
92 && Objects.equals(this.releaseCollection,
93 that.releaseCollection);
99 public String toString() {
100 return MoreObjects.toStringHelper(this).add("deviceId", this.deviceId)
101 .add("applyNum", this.applyNum).add("type", this.type)
102 .add("releaseCollection", this.releaseCollection).toString();