Class AttributesBuilder
- java.lang.Object
-
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder
-
@Generated("mdsal-binding-generator") public class AttributesBuilder extends Object
Class that buildsAttributes
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:
Attributes createAttributes(int fooXyzzy, int barBaz) { return new AttributesBuilder() .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build()) .setBar(new BarBuilder().setBaz(barBaz).build()) .build(); }
This pattern is supported by the immutable nature of Attributes, 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:
Attributes
- 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
-
-
Constructor Summary
Constructors Constructor Description AttributesBuilder()
Construct an empty builder.AttributesBuilder(Attributes base)
Construct a builder initialized with state from specifiedAttributes
.AttributesBuilder(NextHop arg)
Construct a new builder initialized from specifiedNextHop
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AttributesBuilder
addAugmentation(org.opendaylight.yangtools.yang.binding.Augmentation<Attributes> augmentation)
Add an augmentation to this builder's product.<E$$ extends org.opendaylight.yangtools.yang.binding.Augmentation<Attributes>>
E$$augmentation(Class<E$$> augmentationType)
Return the specified augmentation, if it is present in this builder.@NonNull Attributes
build()
A newAttributes
instance.void
fieldsFrom(org.opendaylight.yangtools.yang.binding.DataObject arg)
Set fields from given grouping argument.Aggregator
getAggregator()
Return current value associated with the property corresponding toAttributes.getAggregator()
.Aigp
getAigp()
Return current value associated with the property corresponding toAttributes.getAigp()
.AsPath
getAsPath()
Return current value associated with the property corresponding toAttributes.getAsPath()
.AtomicAggregate
getAtomicAggregate()
Return current value associated with the property corresponding toAttributes.getAtomicAggregate()
.BgpPrefixSid
getBgpPrefixSid()
Return current value associated with the property corresponding toAttributes.getBgpPrefixSid()
.ClusterId
getClusterId()
Return current value associated with the property corresponding toAttributes.getClusterId()
.CNextHop
getCNextHop()
Return current value associated with the property corresponding toNextHop.getCNextHop()
.List<Communities>
getCommunities()
Return current value associated with the property corresponding toAttributes.getCommunities()
.List<ExtendedCommunities>
getExtendedCommunities()
Return current value associated with the property corresponding toAttributes.getExtendedCommunities()
.LocalPref
getLocalPref()
Return current value associated with the property corresponding toAttributes.getLocalPref()
.MultiExitDisc
getMultiExitDisc()
Return current value associated with the property corresponding toAttributes.getMultiExitDisc()
.Origin
getOrigin()
Return current value associated with the property corresponding toAttributes.getOrigin()
.OriginatorId
getOriginatorId()
Return current value associated with the property corresponding toAttributes.getOriginatorId()
.Map<UnrecognizedAttributesKey,UnrecognizedAttributes>
getUnrecognizedAttributes()
Return current value associated with the property corresponding toAttributes.getUnrecognizedAttributes()
.AttributesBuilder
removeAugmentation(Class<? extends org.opendaylight.yangtools.yang.binding.Augmentation<Attributes>> augmentationType)
Remove an augmentation from this builder's product.AttributesBuilder
setAggregator(Aggregator value)
Set the property corresponding toAttributes.getAggregator()
to the specified value.AttributesBuilder
setAigp(Aigp value)
Set the property corresponding toAttributes.getAigp()
to the specified value.AttributesBuilder
setAsPath(AsPath value)
Set the property corresponding toAttributes.getAsPath()
to the specified value.AttributesBuilder
setAtomicAggregate(AtomicAggregate value)
Set the property corresponding toAttributes.getAtomicAggregate()
to the specified value.AttributesBuilder
setBgpPrefixSid(BgpPrefixSid value)
Set the property corresponding toAttributes.getBgpPrefixSid()
to the specified value.AttributesBuilder
setClusterId(ClusterId value)
Set the property corresponding toAttributes.getClusterId()
to the specified value.AttributesBuilder
setCNextHop(CNextHop value)
Set the property corresponding toNextHop.getCNextHop()
to the specified value.AttributesBuilder
setCommunities(List<Communities> values)
Set the property corresponding toAttributes.getCommunities()
to the specified value.AttributesBuilder
setExtendedCommunities(List<ExtendedCommunities> values)
Set the property corresponding toAttributes.getExtendedCommunities()
to the specified value.AttributesBuilder
setLocalPref(LocalPref value)
Set the property corresponding toAttributes.getLocalPref()
to the specified value.AttributesBuilder
setMultiExitDisc(MultiExitDisc value)
Set the property corresponding toAttributes.getMultiExitDisc()
to the specified value.AttributesBuilder
setOrigin(Origin value)
Set the property corresponding toAttributes.getOrigin()
to the specified value.AttributesBuilder
setOriginatorId(OriginatorId value)
Set the property corresponding toAttributes.getOriginatorId()
to the specified value.AttributesBuilder
setUnrecognizedAttributes(Map<UnrecognizedAttributesKey,UnrecognizedAttributes> values)
Set the property corresponding toAttributes.getUnrecognizedAttributes()
to the specified value.
-
-
-
Constructor Detail
-
AttributesBuilder
public AttributesBuilder()
Construct an empty builder.
-
AttributesBuilder
public AttributesBuilder(NextHop arg)
Construct a new builder initialized from specifiedNextHop
.- Parameters:
arg
- NextHop from which the builder should be initialized
-
AttributesBuilder
public AttributesBuilder(Attributes base)
Construct a builder initialized with state from specifiedAttributes
.- Parameters:
base
- Attributes from which the builder should be initialized
-
-
Method Detail
-
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
-
getAggregator
public Aggregator getAggregator()
Return current value associated with the property corresponding toAttributes.getAggregator()
.- Returns:
- current value
-
getAigp
public Aigp getAigp()
Return current value associated with the property corresponding toAttributes.getAigp()
.- Returns:
- current value
-
getAsPath
public AsPath getAsPath()
Return current value associated with the property corresponding toAttributes.getAsPath()
.- Returns:
- current value
-
getAtomicAggregate
public AtomicAggregate getAtomicAggregate()
Return current value associated with the property corresponding toAttributes.getAtomicAggregate()
.- Returns:
- current value
-
getBgpPrefixSid
public BgpPrefixSid getBgpPrefixSid()
Return current value associated with the property corresponding toAttributes.getBgpPrefixSid()
.- Returns:
- current value
-
getCNextHop
public CNextHop getCNextHop()
Return current value associated with the property corresponding toNextHop.getCNextHop()
.- Returns:
- current value
-
getClusterId
public ClusterId getClusterId()
Return current value associated with the property corresponding toAttributes.getClusterId()
.- Returns:
- current value
-
getCommunities
public List<Communities> getCommunities()
Return current value associated with the property corresponding toAttributes.getCommunities()
.- Returns:
- current value
-
getExtendedCommunities
public List<ExtendedCommunities> getExtendedCommunities()
Return current value associated with the property corresponding toAttributes.getExtendedCommunities()
.- Returns:
- current value
-
getLocalPref
public LocalPref getLocalPref()
Return current value associated with the property corresponding toAttributes.getLocalPref()
.- Returns:
- current value
-
getMultiExitDisc
public MultiExitDisc getMultiExitDisc()
Return current value associated with the property corresponding toAttributes.getMultiExitDisc()
.- Returns:
- current value
-
getOrigin
public Origin getOrigin()
Return current value associated with the property corresponding toAttributes.getOrigin()
.- Returns:
- current value
-
getOriginatorId
public OriginatorId getOriginatorId()
Return current value associated with the property corresponding toAttributes.getOriginatorId()
.- Returns:
- current value
-
getUnrecognizedAttributes
public Map<UnrecognizedAttributesKey,UnrecognizedAttributes> getUnrecognizedAttributes()
Return current value associated with the property corresponding toAttributes.getUnrecognizedAttributes()
.- Returns:
- current value
-
augmentation
public <E$$ extends org.opendaylight.yangtools.yang.binding.Augmentation<Attributes>> 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
-
setAggregator
public AttributesBuilder setAggregator(Aggregator value)
Set the property corresponding toAttributes.getAggregator()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setAigp
public AttributesBuilder setAigp(Aigp value)
Set the property corresponding toAttributes.getAigp()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setAsPath
public AttributesBuilder setAsPath(AsPath value)
Set the property corresponding toAttributes.getAsPath()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setAtomicAggregate
public AttributesBuilder setAtomicAggregate(AtomicAggregate value)
Set the property corresponding toAttributes.getAtomicAggregate()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setBgpPrefixSid
public AttributesBuilder setBgpPrefixSid(BgpPrefixSid value)
Set the property corresponding toAttributes.getBgpPrefixSid()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setCNextHop
public AttributesBuilder setCNextHop(CNextHop value)
Set the property corresponding toNextHop.getCNextHop()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setClusterId
public AttributesBuilder setClusterId(ClusterId value)
Set the property corresponding toAttributes.getClusterId()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setCommunities
public AttributesBuilder setCommunities(List<Communities> values)
Set the property corresponding toAttributes.getCommunities()
to the specified value.- Parameters:
values
- desired value- Returns:
- this builder
-
setExtendedCommunities
public AttributesBuilder setExtendedCommunities(List<ExtendedCommunities> values)
Set the property corresponding toAttributes.getExtendedCommunities()
to the specified value.- Parameters:
values
- desired value- Returns:
- this builder
-
setLocalPref
public AttributesBuilder setLocalPref(LocalPref value)
Set the property corresponding toAttributes.getLocalPref()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setMultiExitDisc
public AttributesBuilder setMultiExitDisc(MultiExitDisc value)
Set the property corresponding toAttributes.getMultiExitDisc()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setOrigin
public AttributesBuilder setOrigin(Origin value)
Set the property corresponding toAttributes.getOrigin()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setOriginatorId
public AttributesBuilder setOriginatorId(OriginatorId value)
Set the property corresponding toAttributes.getOriginatorId()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setUnrecognizedAttributes
public AttributesBuilder setUnrecognizedAttributes(Map<UnrecognizedAttributesKey,UnrecognizedAttributes> values)
Set the property corresponding toAttributes.getUnrecognizedAttributes()
to the specified value.- Parameters:
values
- desired value- Returns:
- this builder
-
addAugmentation
public AttributesBuilder addAugmentation(org.opendaylight.yangtools.yang.binding.Augmentation<Attributes> 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 AttributesBuilder removeAugmentation(Class<? extends org.opendaylight.yangtools.yang.binding.Augmentation<Attributes>> 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
public @NonNull Attributes build()
A newAttributes
instance.- Returns:
- A new
Attributes
instance.
-
-