Class StateBuilder
- java.lang.Object
-
- org.opendaylight.yang.gen.v1.http.openconfig.net.yang.platform.rev210118.platform.component.top.components.component.StateBuilder
-
@Generated("mdsal-binding-generator") public class StateBuilder extends Object
Class that buildsStateinstances. 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:
State createState(int fooXyzzy, int barBaz) { return new StateBuilder() .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build()) .setBar(new BarBuilder().setBaz(barBaz).build()) .build(); }This pattern is supported by the immutable nature of State, 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:
State
- 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 StateBuilder()Construct an empty builder.StateBuilder(State base)Construct a builder initialized with state from specifiedState.StateBuilder(PlatformComponentConfig arg)Construct a new builder initialized from specifiedPlatformComponentConfig.StateBuilder(PlatformComponentMemoryState arg)Construct a new builder initialized from specifiedPlatformComponentMemoryState.StateBuilder(PlatformComponentPowerState arg)Construct a new builder initialized from specifiedPlatformComponentPowerState.StateBuilder(PlatformComponentState arg)Construct a new builder initialized from specifiedPlatformComponentState.StateBuilder(PlatformComponentTempState arg)Construct a new builder initialized from specifiedPlatformComponentTempState.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StateBuilderaddAugmentation(org.opendaylight.yangtools.yang.binding.Augmentation<State> augmentation)Add an augmentation to this builder's product.<E$$ extends org.opendaylight.yangtools.yang.binding.Augmentation<State>>
E$$augmentation(Class<E$$> augmentationType)Return the specified augmentation, if it is present in this builder.@NonNull Statebuild()A newStateinstance.voidfieldsFrom(org.opendaylight.yangtools.yang.binding.DataObject arg)Set fields from given grouping argument.org.opendaylight.yangtools.yang.common.Uint32getAllocatedPower()Return current value associated with the property corresponding toPlatformComponentPowerState.getAllocatedPower().StringgetDescription()Return current value associated with the property corresponding toPlatformComponentState.getDescription().BooleangetEmpty()Return current value associated with the property corresponding toPlatformComponentState.getEmpty().StringgetFirmwareVersion()Return current value associated with the property corresponding toPlatformComponentState.getFirmwareVersion().StringgetHardwareVersion()Return current value associated with the property corresponding toPlatformComponentState.getHardwareVersion().StringgetId()Return current value associated with the property corresponding toPlatformComponentState.getId().StringgetLocation()Return current value associated with the property corresponding toPlatformComponentState.getLocation().MemorygetMemory()Return current value associated with the property corresponding toPlatformComponentMemoryState.getMemory().DategetMfgDate()Return current value associated with the property corresponding toPlatformComponentState.getMfgDate().StringgetMfgName()Return current value associated with the property corresponding toPlatformComponentState.getMfgName().StringgetName()Return current value associated with the property corresponding toPlatformComponentConfig.getName().Class<? extends COMPONENTOPERSTATUS>getOperStatus()Return current value associated with the property corresponding toPlatformComponentState.getOperStatus().StringgetParent()Return current value associated with the property corresponding toState.getParent().StringgetPartNo()Return current value associated with the property corresponding toPlatformComponentState.getPartNo().BooleangetRemovable()Return current value associated with the property corresponding toPlatformComponentState.getRemovable().StringgetSerialNo()Return current value associated with the property corresponding toPlatformComponentState.getSerialNo().StringgetSoftwareVersion()Return current value associated with the property corresponding toPlatformComponentState.getSoftwareVersion().TemperaturegetTemperature()Return current value associated with the property corresponding toPlatformComponentTempState.getTemperature().PlatformComponentState.TypegetType()Return current value associated with the property corresponding toPlatformComponentState.getType().org.opendaylight.yangtools.yang.common.Uint32getUsedPower()Return current value associated with the property corresponding toPlatformComponentPowerState.getUsedPower().StateBuilderremoveAugmentation(Class<? extends org.opendaylight.yangtools.yang.binding.Augmentation<State>> augmentationType)Remove an augmentation from this builder's product.StateBuildersetAllocatedPower(org.opendaylight.yangtools.yang.common.Uint32 value)Set the property corresponding toPlatformComponentPowerState.getAllocatedPower()to the specified value.StateBuildersetDescription(String value)Set the property corresponding toPlatformComponentState.getDescription()to the specified value.StateBuildersetEmpty(Boolean value)Set the property corresponding toPlatformComponentState.getEmpty()to the specified value.StateBuildersetFirmwareVersion(String value)Set the property corresponding toPlatformComponentState.getFirmwareVersion()to the specified value.StateBuildersetHardwareVersion(String value)Set the property corresponding toPlatformComponentState.getHardwareVersion()to the specified value.StateBuildersetId(String value)Set the property corresponding toPlatformComponentState.getId()to the specified value.StateBuildersetLocation(String value)Set the property corresponding toPlatformComponentState.getLocation()to the specified value.StateBuildersetMemory(Memory value)Set the property corresponding toPlatformComponentMemoryState.getMemory()to the specified value.StateBuildersetMfgDate(Date value)Set the property corresponding toPlatformComponentState.getMfgDate()to the specified value.StateBuildersetMfgName(String value)Set the property corresponding toPlatformComponentState.getMfgName()to the specified value.StateBuildersetName(String value)Set the property corresponding toPlatformComponentConfig.getName()to the specified value.StateBuildersetOperStatus(Class<? extends COMPONENTOPERSTATUS> value)Set the property corresponding toPlatformComponentState.getOperStatus()to the specified value.StateBuildersetParent(String value)Set the property corresponding toState.getParent()to the specified value.StateBuildersetPartNo(String value)Set the property corresponding toPlatformComponentState.getPartNo()to the specified value.StateBuildersetRemovable(Boolean value)Set the property corresponding toPlatformComponentState.getRemovable()to the specified value.StateBuildersetSerialNo(String value)Set the property corresponding toPlatformComponentState.getSerialNo()to the specified value.StateBuildersetSoftwareVersion(String value)Set the property corresponding toPlatformComponentState.getSoftwareVersion()to the specified value.StateBuildersetTemperature(Temperature value)Set the property corresponding toPlatformComponentTempState.getTemperature()to the specified value.StateBuildersetType(PlatformComponentState.Type value)Set the property corresponding toPlatformComponentState.getType()to the specified value.StateBuildersetUsedPower(org.opendaylight.yangtools.yang.common.Uint32 value)Set the property corresponding toPlatformComponentPowerState.getUsedPower()to the specified value.
-
-
-
Constructor Detail
-
StateBuilder
public StateBuilder()
Construct an empty builder.
-
StateBuilder
public StateBuilder(PlatformComponentConfig arg)
Construct a new builder initialized from specifiedPlatformComponentConfig.- Parameters:
arg- PlatformComponentConfig from which the builder should be initialized
-
StateBuilder
public StateBuilder(PlatformComponentState arg)
Construct a new builder initialized from specifiedPlatformComponentState.- Parameters:
arg- PlatformComponentState from which the builder should be initialized
-
StateBuilder
public StateBuilder(PlatformComponentTempState arg)
Construct a new builder initialized from specifiedPlatformComponentTempState.- Parameters:
arg- PlatformComponentTempState from which the builder should be initialized
-
StateBuilder
public StateBuilder(PlatformComponentMemoryState arg)
Construct a new builder initialized from specifiedPlatformComponentMemoryState.- Parameters:
arg- PlatformComponentMemoryState from which the builder should be initialized
-
StateBuilder
public StateBuilder(PlatformComponentPowerState arg)
Construct a new builder initialized from specifiedPlatformComponentPowerState.- Parameters:
arg- PlatformComponentPowerState 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
-
getAllocatedPower
public org.opendaylight.yangtools.yang.common.Uint32 getAllocatedPower()
Return current value associated with the property corresponding toPlatformComponentPowerState.getAllocatedPower().- Returns:
- current value
-
getDescription
public String getDescription()
Return current value associated with the property corresponding toPlatformComponentState.getDescription().- Returns:
- current value
-
getEmpty
public Boolean getEmpty()
Return current value associated with the property corresponding toPlatformComponentState.getEmpty().- Returns:
- current value
-
getFirmwareVersion
public String getFirmwareVersion()
Return current value associated with the property corresponding toPlatformComponentState.getFirmwareVersion().- Returns:
- current value
-
getHardwareVersion
public String getHardwareVersion()
Return current value associated with the property corresponding toPlatformComponentState.getHardwareVersion().- Returns:
- current value
-
getId
public String getId()
Return current value associated with the property corresponding toPlatformComponentState.getId().- Returns:
- current value
-
getLocation
public String getLocation()
Return current value associated with the property corresponding toPlatformComponentState.getLocation().- Returns:
- current value
-
getMemory
public Memory getMemory()
Return current value associated with the property corresponding toPlatformComponentMemoryState.getMemory().- Returns:
- current value
-
getMfgDate
public Date getMfgDate()
Return current value associated with the property corresponding toPlatformComponentState.getMfgDate().- Returns:
- current value
-
getMfgName
public String getMfgName()
Return current value associated with the property corresponding toPlatformComponentState.getMfgName().- Returns:
- current value
-
getName
public String getName()
Return current value associated with the property corresponding toPlatformComponentConfig.getName().- Returns:
- current value
-
getOperStatus
public Class<? extends COMPONENTOPERSTATUS> getOperStatus()
Return current value associated with the property corresponding toPlatformComponentState.getOperStatus().- Returns:
- current value
-
getParent
public String getParent()
Return current value associated with the property corresponding toState.getParent().- Returns:
- current value
-
getPartNo
public String getPartNo()
Return current value associated with the property corresponding toPlatformComponentState.getPartNo().- Returns:
- current value
-
getRemovable
public Boolean getRemovable()
Return current value associated with the property corresponding toPlatformComponentState.getRemovable().- Returns:
- current value
-
getSerialNo
public String getSerialNo()
Return current value associated with the property corresponding toPlatformComponentState.getSerialNo().- Returns:
- current value
-
getSoftwareVersion
public String getSoftwareVersion()
Return current value associated with the property corresponding toPlatformComponentState.getSoftwareVersion().- Returns:
- current value
-
getTemperature
public Temperature getTemperature()
Return current value associated with the property corresponding toPlatformComponentTempState.getTemperature().- Returns:
- current value
-
getType
public PlatformComponentState.Type getType()
Return current value associated with the property corresponding toPlatformComponentState.getType().- Returns:
- current value
-
getUsedPower
public org.opendaylight.yangtools.yang.common.Uint32 getUsedPower()
Return current value associated with the property corresponding toPlatformComponentPowerState.getUsedPower().- Returns:
- current value
-
augmentation
public <E$$ extends org.opendaylight.yangtools.yang.binding.Augmentation<State>> 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
nullif not present - Throws:
NullPointerException- ifaugmentTypeisnull
-
setAllocatedPower
public StateBuilder setAllocatedPower(org.opendaylight.yangtools.yang.common.Uint32 value)
Set the property corresponding toPlatformComponentPowerState.getAllocatedPower()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setDescription
public StateBuilder setDescription(String value)
Set the property corresponding toPlatformComponentState.getDescription()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setEmpty
public StateBuilder setEmpty(Boolean value)
Set the property corresponding toPlatformComponentState.getEmpty()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setFirmwareVersion
public StateBuilder setFirmwareVersion(String value)
Set the property corresponding toPlatformComponentState.getFirmwareVersion()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setHardwareVersion
public StateBuilder setHardwareVersion(String value)
Set the property corresponding toPlatformComponentState.getHardwareVersion()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setId
public StateBuilder setId(String value)
Set the property corresponding toPlatformComponentState.getId()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setLocation
public StateBuilder setLocation(String value)
Set the property corresponding toPlatformComponentState.getLocation()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setMemory
public StateBuilder setMemory(Memory value)
Set the property corresponding toPlatformComponentMemoryState.getMemory()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setMfgDate
public StateBuilder setMfgDate(Date value)
Set the property corresponding toPlatformComponentState.getMfgDate()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setMfgName
public StateBuilder setMfgName(String value)
Set the property corresponding toPlatformComponentState.getMfgName()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setName
public StateBuilder setName(String value)
Set the property corresponding toPlatformComponentConfig.getName()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setOperStatus
public StateBuilder setOperStatus(Class<? extends COMPONENTOPERSTATUS> value)
Set the property corresponding toPlatformComponentState.getOperStatus()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setParent
public StateBuilder setParent(String value)
Set the property corresponding toState.getParent()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setPartNo
public StateBuilder setPartNo(String value)
Set the property corresponding toPlatformComponentState.getPartNo()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setRemovable
public StateBuilder setRemovable(Boolean value)
Set the property corresponding toPlatformComponentState.getRemovable()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setSerialNo
public StateBuilder setSerialNo(String value)
Set the property corresponding toPlatformComponentState.getSerialNo()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setSoftwareVersion
public StateBuilder setSoftwareVersion(String value)
Set the property corresponding toPlatformComponentState.getSoftwareVersion()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setTemperature
public StateBuilder setTemperature(Temperature value)
Set the property corresponding toPlatformComponentTempState.getTemperature()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setType
public StateBuilder setType(PlatformComponentState.Type value)
Set the property corresponding toPlatformComponentState.getType()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setUsedPower
public StateBuilder setUsedPower(org.opendaylight.yangtools.yang.common.Uint32 value)
Set the property corresponding toPlatformComponentPowerState.getUsedPower()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
addAugmentation
public StateBuilder addAugmentation(org.opendaylight.yangtools.yang.binding.Augmentation<State> augmentation)
Add an augmentation to this builder's product.- Parameters:
augmentation- augmentation to be added- Returns:
- this builder
- Throws:
NullPointerException- ifaugmentationis null
-
removeAugmentation
public StateBuilder removeAugmentation(Class<? extends org.opendaylight.yangtools.yang.binding.Augmentation<State>> 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
-
-