Refactor connectivity intent creation to use builders
- Each connectivity intent now has only one constructor
- Intent constructors are now private for leaf classes and
protected for classes that can be derived from
- Each intent class has a Builder class that accumulates
parameters for intent creation
- Each intent class has a public static builder() method
to create a builder
- Each Builder class has a build() method to create the
intent from the accumulated parameters
- Added keys to a few intent types that were missing them
- Tightened up usage of checkNotNull(), taking advantage of
the return value to save some lines of code
- Modified callers to use the builders instead of directly
calling the constructors
Change-Id: I713185d5ecbadbf51f87ef7f68fec41102106c78
diff --git a/cli/src/main/java/org/onosproject/cli/net/AddMultiPointToSinglePointIntentCommand.java b/cli/src/main/java/org/onosproject/cli/net/AddMultiPointToSinglePointIntentCommand.java
index abc0c4b..892f819 100644
--- a/cli/src/main/java/org/onosproject/cli/net/AddMultiPointToSinglePointIntentCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/AddMultiPointToSinglePointIntentCommand.java
@@ -72,11 +72,16 @@
TrafficTreatment treatment = buildTrafficTreatment();
List<Constraint> constraints = buildConstraints();
- Intent intent = new MultiPointToSinglePointIntent(appId(), key(),
- selector, treatment,
- ingressPoints, egress,
- constraints,
- priority());
+ Intent intent = MultiPointToSinglePointIntent.builder()
+ .appId(appId())
+ .key(key())
+ .selector(selector)
+ .treatment(treatment)
+ .ingressPoints(ingressPoints)
+ .egressPoint(egress)
+ .constraints(constraints)
+ .priority(priority())
+ .build();
service.submit(intent);
print("Multipoint to single point intent submitted:\n%s", intent.toString());
}