Class AllocationInstanceBuilder
- java.lang.Object
-
- org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.network.allocations.AllocationInstanceBuilder
-
- All Implemented Interfaces:
org.opendaylight.yangtools.concepts.Builder<AllocationInstance>
,org.opendaylight.yangtools.concepts.CheckedBuilder<AllocationInstance,java.lang.IllegalArgumentException>
,org.opendaylight.yangtools.concepts.Mutable
,org.opendaylight.yangtools.concepts.MutationBehaviour<org.opendaylight.yangtools.concepts.Mutable>
public class AllocationInstanceBuilder extends java.lang.Object implements org.opendaylight.yangtools.concepts.Builder<AllocationInstance>
Class that buildsAllocationInstanceBuilder
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:
AllocationInstanceBuilder createTarget(int fooXyzzy, int barBaz) { return new AllocationInstanceBuilderBuilder() .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build()) .setBar(new BarBuilder().setBaz(barBaz).build()) .build(); }
This pattern is supported by the immutable nature of AllocationInstanceBuilder, 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:
AllocationInstanceBuilder
,Builder
-
-
Constructor Summary
Constructors Constructor Description AllocationInstanceBuilder()
AllocationInstanceBuilder(AllocationInstance base)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AllocationInstanceBuilder
addAugmentation(java.lang.Class<? extends org.opendaylight.yangtools.yang.binding.Augmentation<AllocationInstance>> augmentationType, org.opendaylight.yangtools.yang.binding.Augmentation<AllocationInstance> augmentationValue)
<E$$ extends org.opendaylight.yangtools.yang.binding.Augmentation<AllocationInstance>>
E$$augmentation(java.lang.Class<E$$> augmentationType)
AllocationInstance
build()
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress
getAllocatedIp()
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress
getMac()
AllocationInstanceKey
key()
AllocationInstanceBuilder
removeAugmentation(java.lang.Class<? extends org.opendaylight.yangtools.yang.binding.Augmentation<AllocationInstance>> augmentationType)
AllocationInstanceBuilder
setAllocatedIp(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress value)
AllocationInstanceBuilder
setMac(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress value)
AllocationInstanceBuilder
withKey(AllocationInstanceKey key)
-
-
-
Constructor Detail
-
AllocationInstanceBuilder
public AllocationInstanceBuilder()
-
AllocationInstanceBuilder
public AllocationInstanceBuilder(AllocationInstance base)
-
-
Method Detail
-
key
public AllocationInstanceKey key()
-
getAllocatedIp
public org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress getAllocatedIp()
-
getMac
public org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress getMac()
-
augmentation
public <E$$ extends org.opendaylight.yangtools.yang.binding.Augmentation<AllocationInstance>> E$$ augmentation(java.lang.Class<E$$> augmentationType)
-
withKey
public AllocationInstanceBuilder withKey(AllocationInstanceKey key)
-
setAllocatedIp
public AllocationInstanceBuilder setAllocatedIp(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress value)
-
setMac
public AllocationInstanceBuilder setMac(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress value)
-
addAugmentation
public AllocationInstanceBuilder addAugmentation(java.lang.Class<? extends org.opendaylight.yangtools.yang.binding.Augmentation<AllocationInstance>> augmentationType, org.opendaylight.yangtools.yang.binding.Augmentation<AllocationInstance> augmentationValue)
-
removeAugmentation
public AllocationInstanceBuilder removeAugmentation(java.lang.Class<? extends org.opendaylight.yangtools.yang.binding.Augmentation<AllocationInstance>> augmentationType)
-
build
public AllocationInstance build()
- Specified by:
build
in interfaceorg.opendaylight.yangtools.concepts.Builder<AllocationInstance>
- Specified by:
build
in interfaceorg.opendaylight.yangtools.concepts.CheckedBuilder<AllocationInstance,java.lang.IllegalArgumentException>
-
-