Class BgpRouter1Builder
- java.lang.Object
-
- org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.BgpRouter1Builder
-
- All Implemented Interfaces:
org.opendaylight.yangtools.concepts.Builder<BgpRouter1>
,org.opendaylight.yangtools.concepts.CheckedBuilder<BgpRouter1,java.lang.IllegalArgumentException>
,org.opendaylight.yangtools.concepts.Mutable
,org.opendaylight.yangtools.concepts.MutationBehaviour<org.opendaylight.yangtools.concepts.Mutable>
public class BgpRouter1Builder extends java.lang.Object implements org.opendaylight.yangtools.concepts.Builder<BgpRouter1>
Class that buildsBgpRouter1Builder
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:
BgpRouter1Builder createTarget(int fooXyzzy, int barBaz) { return new BgpRouter1BuilderBuilder() .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build()) .setBar(new BarBuilder().setBaz(barBaz).build()) .build(); }
This pattern is supported by the immutable nature of BgpRouter1Builder, 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:
BgpRouter1Builder
,Builder
-
-
Constructor Summary
Constructors Constructor Description BgpRouter1Builder()
BgpRouter1Builder(BgpRouter1 base)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BgpRouter1
build()
BgpAfIpv4VpnInstances
getBgpAfIpv4VpnInstances()
BgpAfIpv6VpnInstances
getBgpAfIpv6VpnInstances()
BgpRouter1Builder
setBgpAfIpv4VpnInstances(BgpAfIpv4VpnInstances value)
BgpRouter1Builder
setBgpAfIpv6VpnInstances(BgpAfIpv6VpnInstances value)
-
-
-
Constructor Detail
-
BgpRouter1Builder
public BgpRouter1Builder()
-
BgpRouter1Builder
public BgpRouter1Builder(BgpRouter1 base)
-
-
Method Detail
-
getBgpAfIpv4VpnInstances
public BgpAfIpv4VpnInstances getBgpAfIpv4VpnInstances()
-
getBgpAfIpv6VpnInstances
public BgpAfIpv6VpnInstances getBgpAfIpv6VpnInstances()
-
setBgpAfIpv4VpnInstances
public BgpRouter1Builder setBgpAfIpv4VpnInstances(BgpAfIpv4VpnInstances value)
-
setBgpAfIpv6VpnInstances
public BgpRouter1Builder setBgpAfIpv6VpnInstances(BgpAfIpv6VpnInstances value)
-
build
public BgpRouter1 build()
- Specified by:
build
in interfaceorg.opendaylight.yangtools.concepts.Builder<BgpRouter1>
- Specified by:
build
in interfaceorg.opendaylight.yangtools.concepts.CheckedBuilder<BgpRouter1,java.lang.IllegalArgumentException>
-
-