Class AddressBuilder
- java.lang.Object
-
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev180222.interfaces._interface.ipv6.AddressBuilder
-
- All Implemented Interfaces:
Builder<Address>
,CheckedBuilder<Address,IllegalArgumentException>
,Mutable
,MutationBehaviour<Mutable>
@Generated("mdsal-binding-generator") public class AddressBuilder extends Object implements Builder<Address>
Class that buildsAddressBuilder
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:
AddressBuilder createTarget(int fooXyzzy, int barBaz) { return new AddressBuilderBuilder() .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build()) .setBar(new BarBuilder().setBaz(barBaz).build()) .build(); }
This pattern is supported by the immutable nature of AddressBuilder, 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 oportunities, 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:
AddressBuilder
,Builder
-
-
Constructor Summary
Constructors Constructor Description AddressBuilder()
AddressBuilder(Address base)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AddressBuilder
addAugmentation(Augmentation<Address> augmentation)
Add an augmentation to this builder's product.<E$$ extends Augmentation<Address>>
E$$augmentation(Class<E$$> augmentationType)
Address
build()
Ipv6AddressNoZone
getIp()
IpAddressOrigin
getOrigin()
Uint8
getPrefixLength()
Address.Status
getStatus()
AddressKey
key()
AddressBuilder
removeAugmentation(Class<? extends Augmentation<Address>> augmentationType)
Remove an augmentation from this builder's product.AddressBuilder
setIp(Ipv6AddressNoZone value)
AddressBuilder
setOrigin(IpAddressOrigin value)
AddressBuilder
setPrefixLength(Uint8 value)
AddressBuilder
setStatus(Address.Status value)
AddressBuilder
withKey(AddressKey key)
-
-
-
Constructor Detail
-
AddressBuilder
public AddressBuilder()
-
AddressBuilder
public AddressBuilder(Address base)
-
-
Method Detail
-
key
public AddressKey key()
-
getIp
public Ipv6AddressNoZone getIp()
-
getOrigin
public IpAddressOrigin getOrigin()
-
getPrefixLength
public Uint8 getPrefixLength()
-
getStatus
public Address.Status getStatus()
-
augmentation
public <E$$ extends Augmentation<Address>> E$$ augmentation(Class<E$$> augmentationType)
-
withKey
public AddressBuilder withKey(AddressKey key)
-
setIp
public AddressBuilder setIp(Ipv6AddressNoZone value)
-
setOrigin
public AddressBuilder setOrigin(IpAddressOrigin value)
-
setPrefixLength
public AddressBuilder setPrefixLength(Uint8 value)
-
setStatus
public AddressBuilder setStatus(Address.Status value)
-
addAugmentation
public AddressBuilder addAugmentation(Augmentation<Address> 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 AddressBuilder removeAugmentation(Class<? extends Augmentation<Address>> 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 Address build()
- Specified by:
build
in interfaceBuilder<Address>
- Specified by:
build
in interfaceCheckedBuilder<Address,IllegalArgumentException>
-
-