Class NodeAttributesBuilder
java.lang.Object
org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.path.attribute.link.state.attribute.node.attributes._case.NodeAttributesBuilder
Class that builds
NodeAttributes
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:
NodeAttributes createNodeAttributes(int fooXyzzy, int barBaz) {
return new NodeAttributesBuilder()
.setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
.setBar(new BarBuilder().setBaz(barBaz).build())
.build();
}
This pattern is supported by the immutable nature of NodeAttributes, 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
ConstructorDescriptionConstruct an empty builder.Construct a builder initialized with state from specifiedNodeAttributes
.Construct a new builder initialized from specifiedNodeState
. -
Method Summary
Modifier and TypeMethodDescriptionaddAugmentation
(org.opendaylight.yangtools.binding.Augmentation<NodeAttributes> augmentation) Add an augmentation to this builder's product.<E$$ extends org.opendaylight.yangtools.binding.Augmentation<NodeAttributes>>
E$$augmentation
(Class<E$$> augmentationType) Return the specified augmentation, if it is present in this builder.@NonNull NodeAttributes
build()
A newNodeAttributes
instance.static @NonNull NodeAttributes
empty()
Get empty instance of NodeAttributes.void
fieldsFrom
(org.opendaylight.yangtools.binding.Grouping arg) Set fields from given grouping argument.Return current value associated with the property corresponding toNodeState.getDynamicHostname()
.Return current value associated with the property corresponding toNodeState.getIpv4RouterId()
.Return current value associated with the property corresponding toNodeState.getIpv6RouterId()
.Return current value associated with the property corresponding toNodeState.getIsisAreaId()
.Return current value associated with the property corresponding toNodeState.getNodeFlags()
.Return current value associated with the property corresponding toNodeState.getSrAlgorithm()
.Return current value associated with the property corresponding toNodeState.getSrCapabilities()
.Return current value associated with the property corresponding toNodeState.getTopologyIdentifier()
.removeAugmentation
(Class<? extends org.opendaylight.yangtools.binding.Augmentation<NodeAttributes>> augmentationType) Remove an augmentation from this builder's product.setDynamicHostname
(String value) Set the property corresponding toNodeState.getDynamicHostname()
to the specified value.Set the property corresponding toNodeState.getIpv4RouterId()
to the specified value.Set the property corresponding toNodeState.getIpv6RouterId()
to the specified value.setIsisAreaId
(Set<IsisAreaIdentifier> values) Set the property corresponding toNodeState.getIsisAreaId()
to the specified value.setNodeFlags
(NodeFlagBits value) Set the property corresponding toNodeState.getNodeFlags()
to the specified value.setSrAlgorithm
(SrAlgorithm value) Set the property corresponding toNodeState.getSrAlgorithm()
to the specified value.setSrCapabilities
(SrCapabilities value) Set the property corresponding toNodeState.getSrCapabilities()
to the specified value.setTopologyIdentifier
(Set<TopologyIdentifier> values) Set the property corresponding toNodeState.getTopologyIdentifier()
to the specified value.
-
Constructor Details
-
NodeAttributesBuilder
public NodeAttributesBuilder()Construct an empty builder. -
NodeAttributesBuilder
Construct a new builder initialized from specifiedNodeState
.- Parameters:
arg
- NodeState from which the builder should be initialized
-
NodeAttributesBuilder
Construct a builder initialized with state from specifiedNodeAttributes
.- Parameters:
base
- NodeAttributes from which the builder should be initialized
-
-
Method Details
-
fieldsFrom
public void fieldsFrom(org.opendaylight.yangtools.binding.Grouping 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
-
empty
Get empty instance of NodeAttributes.- Returns:
- An empty
NodeAttributes
-
getDynamicHostname
Return current value associated with the property corresponding toNodeState.getDynamicHostname()
.- Returns:
- current value
-
getIpv4RouterId
Return current value associated with the property corresponding toNodeState.getIpv4RouterId()
.- Returns:
- current value
-
getIpv6RouterId
Return current value associated with the property corresponding toNodeState.getIpv6RouterId()
.- Returns:
- current value
-
getIsisAreaId
Return current value associated with the property corresponding toNodeState.getIsisAreaId()
.- Returns:
- current value
-
getNodeFlags
Return current value associated with the property corresponding toNodeState.getNodeFlags()
.- Returns:
- current value
-
getSrAlgorithm
Return current value associated with the property corresponding toNodeState.getSrAlgorithm()
.- Returns:
- current value
-
getSrCapabilities
Return current value associated with the property corresponding toNodeState.getSrCapabilities()
.- Returns:
- current value
-
getTopologyIdentifier
Return current value associated with the property corresponding toNodeState.getTopologyIdentifier()
.- Returns:
- current value
-
augmentation
public <E$$ extends org.opendaylight.yangtools.binding.Augmentation<NodeAttributes>> 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
null
if not present - Throws:
NullPointerException
- ifaugmentType
isnull
-
setDynamicHostname
Set the property corresponding toNodeState.getDynamicHostname()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setIpv4RouterId
Set the property corresponding toNodeState.getIpv4RouterId()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setIpv6RouterId
Set the property corresponding toNodeState.getIpv6RouterId()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setIsisAreaId
Set the property corresponding toNodeState.getIsisAreaId()
to the specified value.- Parameters:
values
- desired value- Returns:
- this builder
-
setNodeFlags
Set the property corresponding toNodeState.getNodeFlags()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setSrAlgorithm
Set the property corresponding toNodeState.getSrAlgorithm()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setSrCapabilities
Set the property corresponding toNodeState.getSrCapabilities()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setTopologyIdentifier
Set the property corresponding toNodeState.getTopologyIdentifier()
to the specified value.- Parameters:
values
- desired value- Returns:
- this builder
-
addAugmentation
public NodeAttributesBuilder addAugmentation(org.opendaylight.yangtools.binding.Augmentation<NodeAttributes> augmentation) Add an augmentation to this builder's product.- Parameters:
augmentation
- augmentation to be added- Returns:
- this builder
- Throws:
NullPointerException
- ifaugmentation
is null
-
removeAugmentation
public NodeAttributesBuilder removeAugmentation(Class<? extends org.opendaylight.yangtools.binding.Augmentation<NodeAttributes>> 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 newNodeAttributes
instance.- Returns:
- A new
NodeAttributes
instance.
-