Class Contlist1Builder
java.lang.Object
org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.cont2.Contlist1Builder
Class that builds
Contlist1 instances. Overall design of the class is that of a
fluent interface, where method chaining is used.
In general, this class is supposed to be used like this template:
Contlist1 createContlist1(int fooXyzzy, int barBaz) {
return new Contlist1Builder()
.setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
.setBar(new BarBuilder().setBaz(barBaz).build())
.build();
}
This pattern is supported by the immutable nature of Contlist1, as instances can be freely passed around without worrying about synchronization issues.
As a side note: method chaining results in:
- very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is
on the stack, so further method invocations just need to fill method arguments for the next method
invocation, which is terminated by
build(), which is then returned from the method - better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is very localized
- better optimization opportunities, as the object scope is minimized in terms of invocation (rather than method) stack, making escape analysis a lot easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely eliminated
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct an empty builder.Contlist1Builder(Contlist1 base) Construct a builder initialized with state from specifiedContlist1.Construct a new builder initialized from specifiedEnumGrouping. -
Method Summary
Modifier and TypeMethodDescriptionaddAugmentation(org.opendaylight.yangtools.yang.binding.Augmentation<Contlist1> augmentation) Add an augmentation to this builder's product.<E$$ extends org.opendaylight.yangtools.yang.binding.Augmentation<Contlist1>>
E$$augmentation(Class<E$$> augmentationType) Return the specified augmentation, if it is present in this builder.@NonNull Contlist1build()A newContlist1instance.voidfieldsFrom(org.opendaylight.yangtools.yang.binding.DataObject arg) Set fields from given grouping argument.Return current value associated with the property corresponding toEnumGrouping.getAttrEnum().Return current value associated with the property corresponding toContlist1.getAttrStr().key()Return current value associated with the property corresponding toContlist1.key().removeAugmentation(Class<? extends org.opendaylight.yangtools.yang.binding.Augmentation<Contlist1>> augmentationType) Remove an augmentation from this builder's product.setAttrEnum(CustomEnum value) Set the property corresponding toEnumGrouping.getAttrEnum()to the specified value.setAttrStr(String value) Set the property corresponding toContlist1.getAttrStr()to the specified value.withKey(Contlist1Key key) Set the key value corresponding toContlist1.key()to the specified value.
-
Constructor Details
-
Contlist1Builder
public Contlist1Builder()Construct an empty builder. -
Contlist1Builder
Construct a new builder initialized from specifiedEnumGrouping.- Parameters:
arg- EnumGrouping from which the builder should be initialized
-
Contlist1Builder
Construct a builder initialized with state from specifiedContlist1.- Parameters:
base- Contlist1 from which the builder should be initialized
-
-
Method Details
-
fieldsFrom
public void fieldsFrom(org.opendaylight.yangtools.yang.binding.DataObject arg) Set fields from given grouping argument. Valid argument is instance of one of following types:- Parameters:
arg- grouping object- Throws:
IllegalArgumentException- if given argument is none of valid types or has property with incompatible value
-
key
Return current value associated with the property corresponding toContlist1.key().- Returns:
- current value
-
getAttrEnum
Return current value associated with the property corresponding toEnumGrouping.getAttrEnum().- Returns:
- current value
-
getAttrStr
Return current value associated with the property corresponding toContlist1.getAttrStr().- Returns:
- current value
-
augmentation
public <E$$ extends org.opendaylight.yangtools.yang.binding.Augmentation<Contlist1>> E$$ augmentation(Class<E$$> augmentationType) Return the specified augmentation, if it is present in this builder.- Type Parameters:
E$$- augmentation type- Parameters:
augmentationType- augmentation type class- Returns:
- Augmentation object from this builder, or
nullif not present - Throws:
NullPointerException- ifaugmentTypeisnull
-
withKey
Set the key value corresponding toContlist1.key()to the specified value.- Parameters:
key- desired value- Returns:
- this builder
-
setAttrEnum
Set the property corresponding toEnumGrouping.getAttrEnum()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setAttrStr
Set the property corresponding toContlist1.getAttrStr()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
addAugmentation
public Contlist1Builder addAugmentation(org.opendaylight.yangtools.yang.binding.Augmentation<Contlist1> augmentation) Add an augmentation to this builder's product.- Parameters:
augmentation- augmentation to be added- Returns:
- this builder
- Throws:
NullPointerException- ifaugmentationis null
-
removeAugmentation
public Contlist1Builder removeAugmentation(Class<? extends org.opendaylight.yangtools.yang.binding.Augmentation<Contlist1>> augmentationType) Remove an augmentation from this builder's product. If this builder does not track such an augmentation type, this method does nothing.- Parameters:
augmentationType- augmentation type to be removed- Returns:
- this builder
-
build
A newContlist1instance.- Returns:
- A new
Contlist1instance.
-