Inline static factory methods in BandwidthResource
Change-Id: I8ac7fbaea5c81c9558f88f6ac88bcf581466d073
diff --git a/core/api/src/main/java/org/onosproject/net/resource/BandwidthResource.java b/core/api/src/main/java/org/onosproject/net/resource/BandwidthResource.java
index 0f39198..3c8ebea 100644
--- a/core/api/src/main/java/org/onosproject/net/resource/BandwidthResource.java
+++ b/core/api/src/main/java/org/onosproject/net/resource/BandwidthResource.java
@@ -33,7 +33,7 @@
*
* @param bandwidth bandwidth value to be assigned
*/
- private BandwidthResource(Bandwidth bandwidth) {
+ public BandwidthResource(Bandwidth bandwidth) {
this.bandwidth = checkNotNull(bandwidth);
}
@@ -43,61 +43,6 @@
}
/**
- * Creates a new instance with given bandwidth in bps.
- *
- * @param bandwidth bandwidth value to be assigned
- * @return {@link BandwidthResource} instance with given bandwidth
- */
- @Deprecated
- public static BandwidthResource valueOf(double bandwidth) {
- return bps(bandwidth);
- }
-
- public static BandwidthResource from(Bandwidth bandwidth) {
- return new BandwidthResource(bandwidth);
- }
-
- /**
- * Creates a new instance with given bandwidth in bps.
- *
- * @param bps bandwidth value to be assigned
- * @return {@link BandwidthResource} instance with given bandwidth
- */
- public static BandwidthResource bps(double bps) {
- return from(Bandwidth.bps(bps));
- }
-
- /**
- * Creates a new instance with given bandwidth in Kbps.
- *
- * @param kbps bandwidth value to be assigned
- * @return {@link BandwidthResource} instance with given bandwidth
- */
- public static BandwidthResource kbps(double kbps) {
- return from(Bandwidth.kbps(kbps));
- }
-
- /**
- * Creates a new instance with given bandwidth in Mbps.
- *
- * @param mbps bandwidth value to be assigned
- * @return {@link BandwidthResource} instance with given bandwidth
- */
- public static BandwidthResource mbps(double mbps) {
- return from(Bandwidth.mbps(mbps));
- }
-
- /**
- * Creates a new instance with given bandwidth in Gbps.
- *
- * @param gbps bandwidth value to be assigned
- * @return {@link BandwidthResource} instance with given bandwidth
- */
- public static BandwidthResource gbps(double gbps) {
- return from(Bandwidth.gbps(gbps));
- }
-
- /**
* Returns bandwidth as a double value.
*
* @return bandwidth as a double value
diff --git a/core/api/src/main/java/org/onosproject/net/resource/DefaultLinkResourceRequest.java b/core/api/src/main/java/org/onosproject/net/resource/DefaultLinkResourceRequest.java
index 1ec1fc4..8d08e3b 100644
--- a/core/api/src/main/java/org/onosproject/net/resource/DefaultLinkResourceRequest.java
+++ b/core/api/src/main/java/org/onosproject/net/resource/DefaultLinkResourceRequest.java
@@ -20,6 +20,7 @@
import java.util.Set;
import java.util.Objects;
+import org.onlab.util.Bandwidth;
import org.onosproject.net.Link;
import org.onosproject.net.intent.Constraint;
import org.onosproject.net.intent.IntentId;
@@ -137,7 +138,7 @@
*/
@Override
public Builder addBandwidthRequest(double bandwidth) {
- resources.add(new BandwidthResourceRequest(BandwidthResource.bps(bandwidth)));
+ resources.add(new BandwidthResourceRequest(new BandwidthResource(Bandwidth.bps(bandwidth))));
return this;
}