Class ComponentBuilder
- java.lang.Object
-
- org.opendaylight.yang.gen.v1.http.openconfig.net.yang.platform.rev210118.platform.component.top.components.ComponentBuilder
-
- All Implemented Interfaces:
org.opendaylight.yangtools.concepts.Builder<Component>,org.opendaylight.yangtools.concepts.CheckedBuilder<Component,IllegalArgumentException>,org.opendaylight.yangtools.concepts.Mutable,org.opendaylight.yangtools.concepts.MutationBehaviour<org.opendaylight.yangtools.concepts.Mutable>
@Generated("mdsal-binding-generator") public class ComponentBuilder extends Object implements org.opendaylight.yangtools.concepts.Builder<Component>
Class that buildsComponentinstances. 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:
Component createComponent(int fooXyzzy, int barBaz) { return new ComponentBuilder() .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build()) .setBar(new BarBuilder().setBaz(barBaz).build()) .build(); }This pattern is supported by the immutable nature of Component, 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:
Component,Builder
-
-
Constructor Summary
Constructors Constructor Description ComponentBuilder()ComponentBuilder(Component base)ComponentBuilder(PlatformAnchorsTop arg)ComponentBuilder(PlatformComponentPropertiesTop arg)ComponentBuilder(PlatformSubcomponentRefTop arg)
-
Method Summary
-
-
-
Constructor Detail
-
ComponentBuilder
public ComponentBuilder()
-
ComponentBuilder
public ComponentBuilder(PlatformComponentPropertiesTop arg)
-
ComponentBuilder
public ComponentBuilder(PlatformSubcomponentRefTop arg)
-
ComponentBuilder
public ComponentBuilder(PlatformAnchorsTop arg)
-
ComponentBuilder
public ComponentBuilder(Component base)
-
-
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:- PlatformSubcomponentRefTop
- PlatformAnchorsTop
- PlatformComponentPropertiesTop
- Parameters:
arg- grouping object- Throws:
IllegalArgumentException- if given argument is none of valid types or has property with incompatible value
-
key
public ComponentKey key()
-
getBackplane
public Backplane getBackplane()
-
getChassis
public Chassis getChassis()
-
getConfig
public Config getConfig()
-
getCpu
public Cpu getCpu()
-
getFabric
public Fabric getFabric()
-
getFan
public Fan getFan()
-
getIntegratedCircuit
public IntegratedCircuit getIntegratedCircuit()
-
getName
public String getName()
-
getPort
public Port getPort()
-
getPowerSupply
public PowerSupply getPowerSupply()
-
getProperties
public Properties getProperties()
-
getSoftwareModule
public SoftwareModule getSoftwareModule()
-
getState
public State getState()
-
getStorage
public Storage getStorage()
-
getSubcomponents
public Subcomponents getSubcomponents()
-
augmentation
public <E$$ extends org.opendaylight.yangtools.yang.binding.Augmentation<Component>> E$$ augmentation(Class<E$$> augmentationType)
-
withKey
public ComponentBuilder withKey(ComponentKey key)
-
setBackplane
public ComponentBuilder setBackplane(Backplane value)
-
setChassis
public ComponentBuilder setChassis(Chassis value)
-
setConfig
public ComponentBuilder setConfig(Config value)
-
setCpu
public ComponentBuilder setCpu(Cpu value)
-
setFabric
public ComponentBuilder setFabric(Fabric value)
-
setFan
public ComponentBuilder setFan(Fan value)
-
setIntegratedCircuit
public ComponentBuilder setIntegratedCircuit(IntegratedCircuit value)
-
setName
public ComponentBuilder setName(String value)
-
setPort
public ComponentBuilder setPort(Port value)
-
setPowerSupply
public ComponentBuilder setPowerSupply(PowerSupply value)
-
setProperties
public ComponentBuilder setProperties(Properties value)
-
setSoftwareModule
public ComponentBuilder setSoftwareModule(SoftwareModule value)
-
setState
public ComponentBuilder setState(State value)
-
setStorage
public ComponentBuilder setStorage(Storage value)
-
setSubcomponents
public ComponentBuilder setSubcomponents(Subcomponents value)
-
addAugmentation
public ComponentBuilder addAugmentation(org.opendaylight.yangtools.yang.binding.Augmentation<Component> augmentation)
Add an augmentation to this builder's product.- Parameters:
augmentation- augmentation to be added- Returns:
- this builder
- Throws:
NullPointerException- ifaugmentationis null
-
removeAugmentation
public ComponentBuilder removeAugmentation(Class<? extends org.opendaylight.yangtools.yang.binding.Augmentation<Component>> 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 Component build()
- Specified by:
buildin interfaceorg.opendaylight.yangtools.concepts.Builder<Component>- Specified by:
buildin interfaceorg.opendaylight.yangtools.concepts.CheckedBuilder<Component,IllegalArgumentException>
-
-