2 * Copyright 2014-2015 Open Networking Laboratory
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org.onosproject.net.resource.link;
18 import java.util.Objects;
20 import com.google.common.base.MoreObjects;
21 import org.onosproject.net.resource.ResourceRequest;
22 import org.onosproject.net.resource.ResourceType;
25 * Representation of a request for bandwidth resource.
27 public class BandwidthResourceRequest implements ResourceRequest {
28 private final BandwidthResource bandwidth;
31 * Creates a new {@link BandwidthResourceRequest} with {@link BandwidthResource}
34 * @param bandwidth {@link BandwidthResource} object to be requested
36 public BandwidthResourceRequest(BandwidthResource bandwidth) {
37 this.bandwidth = bandwidth;
41 * Returns the bandwidth resource.
43 * @return the bandwidth resource
45 public BandwidthResource bandwidth() {
50 public ResourceType type() {
51 return ResourceType.BANDWIDTH;
55 public int hashCode() {
56 return bandwidth.hashCode();
60 public boolean equals(Object obj) {
64 if (obj == null || getClass() != obj.getClass()) {
67 final BandwidthResourceRequest other = (BandwidthResourceRequest) obj;
68 return Objects.equals(this.bandwidth, other.bandwidth());
72 public String toString() {
73 return MoreObjects.toStringHelper(this)
74 .add("bandwidth", bandwidth)