Class StateBuilder
java.lang.Object
org.opendaylight.yang.gen.v1.http.openconfig.net.yang.platform.rev210118.platform.component.top.components.component.StateBuilder
Class that builds
State 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:
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:
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct an empty builder.StateBuilder(State base) Construct a builder initialized with state from specifiedState.Construct a new builder initialized from specifiedPlatformComponentConfig.Construct a new builder initialized from specifiedPlatformComponentMemoryState.Construct a new builder initialized from specifiedPlatformComponentPowerState.Construct a new builder initialized from specifiedPlatformComponentState.Construct a new builder initialized from specifiedPlatformComponentTempState. -
Method Summary
Modifier and TypeMethodDescriptionaddAugmentation(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.static @NonNull Stateempty()Get empty instance of State.voidfieldsFrom(org.opendaylight.yangtools.yang.binding.DataObject arg) Set fields from given grouping argument.org.opendaylight.yangtools.yang.common.Uint32Return current value associated with the property corresponding toPlatformComponentPowerState.getAllocatedPower().Return current value associated with the property corresponding toPlatformComponentState.getDescription().getEmpty()Return current value associated with the property corresponding toPlatformComponentState.getEmpty().Return current value associated with the property corresponding toPlatformComponentState.getFirmwareVersion().Return current value associated with the property corresponding toPlatformComponentState.getHardwareVersion().getId()Return current value associated with the property corresponding toPlatformComponentState.getId().Return current value associated with the property corresponding toPlatformComponentState.getLocation().Return current value associated with the property corresponding toPlatformComponentMemoryState.getMemory().Return current value associated with the property corresponding toPlatformComponentState.getMfgDate().Return current value associated with the property corresponding toPlatformComponentState.getMfgName().getName()Return current value associated with the property corresponding toPlatformComponentConfig.getName().Return current value associated with the property corresponding toPlatformComponentState.getOperStatus().Return current value associated with the property corresponding toState.getParent().Return current value associated with the property corresponding toPlatformComponentState.getPartNo().Return current value associated with the property corresponding toPlatformComponentState.getRemovable().Return current value associated with the property corresponding toPlatformComponentState.getSerialNo().Return current value associated with the property corresponding toPlatformComponentState.getSoftwareVersion().Return current value associated with the property corresponding toPlatformComponentTempState.getTemperature().getType()Return current value associated with the property corresponding toPlatformComponentState.getType().org.opendaylight.yangtools.yang.common.Uint32Return current value associated with the property corresponding toPlatformComponentPowerState.getUsedPower().removeAugmentation(Class<? extends org.opendaylight.yangtools.yang.binding.Augmentation<State>> augmentationType) Remove an augmentation from this builder's product.setAllocatedPower(org.opendaylight.yangtools.yang.common.Uint32 value) Set the property corresponding toPlatformComponentPowerState.getAllocatedPower()to the specified value.setDescription(String value) Set the property corresponding toPlatformComponentState.getDescription()to the specified value.Set the property corresponding toPlatformComponentState.getEmpty()to the specified value.setFirmwareVersion(String value) Set the property corresponding toPlatformComponentState.getFirmwareVersion()to the specified value.setHardwareVersion(String value) Set the property corresponding toPlatformComponentState.getHardwareVersion()to the specified value.Set the property corresponding toPlatformComponentState.getId()to the specified value.setLocation(String value) Set the property corresponding toPlatformComponentState.getLocation()to the specified value.Set the property corresponding toPlatformComponentMemoryState.getMemory()to the specified value.setMfgDate(Date value) Set the property corresponding toPlatformComponentState.getMfgDate()to the specified value.setMfgName(String value) Set the property corresponding toPlatformComponentState.getMfgName()to the specified value.Set the property corresponding toPlatformComponentConfig.getName()to the specified value.setOperStatus(COMPONENTOPERSTATUS value) Set the property corresponding toPlatformComponentState.getOperStatus()to the specified value.Set the property corresponding toState.getParent()to the specified value.Set the property corresponding toPlatformComponentState.getPartNo()to the specified value.setRemovable(Boolean value) Set the property corresponding toPlatformComponentState.getRemovable()to the specified value.setSerialNo(String value) Set the property corresponding toPlatformComponentState.getSerialNo()to the specified value.setSoftwareVersion(String value) Set the property corresponding toPlatformComponentState.getSoftwareVersion()to the specified value.setTemperature(Temperature value) Set the property corresponding toPlatformComponentTempState.getTemperature()to the specified value.Set the property corresponding toPlatformComponentState.getType()to the specified value.setUsedPower(org.opendaylight.yangtools.yang.common.Uint32 value) Set the property corresponding toPlatformComponentPowerState.getUsedPower()to the specified value.
-
Constructor Details
-
StateBuilder
public StateBuilder()Construct an empty builder. -
StateBuilder
Construct a new builder initialized from specifiedPlatformComponentConfig.- Parameters:
arg- PlatformComponentConfig from which the builder should be initialized
-
StateBuilder
Construct a new builder initialized from specifiedPlatformComponentState.- Parameters:
arg- PlatformComponentState from which the builder should be initialized
-
StateBuilder
Construct a new builder initialized from specifiedPlatformComponentTempState.- Parameters:
arg- PlatformComponentTempState from which the builder should be initialized
-
StateBuilder
Construct a new builder initialized from specifiedPlatformComponentMemoryState.- Parameters:
arg- PlatformComponentMemoryState from which the builder should be initialized
-
StateBuilder
Construct a new builder initialized from specifiedPlatformComponentPowerState.- Parameters:
arg- PlatformComponentPowerState from which the builder should be initialized
-
StateBuilder
Construct a builder initialized with state from specifiedState.- Parameters:
base- State from which the builder should be initialized
-
-
Method Details
-
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
-
empty
Get empty instance of State.- Returns:
- An empty
State
-
getAllocatedPower
public org.opendaylight.yangtools.yang.common.Uint32 getAllocatedPower()Return current value associated with the property corresponding toPlatformComponentPowerState.getAllocatedPower().- Returns:
- current value
-
getDescription
Return current value associated with the property corresponding toPlatformComponentState.getDescription().- Returns:
- current value
-
getEmpty
Return current value associated with the property corresponding toPlatformComponentState.getEmpty().- Returns:
- current value
-
getFirmwareVersion
Return current value associated with the property corresponding toPlatformComponentState.getFirmwareVersion().- Returns:
- current value
-
getHardwareVersion
Return current value associated with the property corresponding toPlatformComponentState.getHardwareVersion().- Returns:
- current value
-
getId
Return current value associated with the property corresponding toPlatformComponentState.getId().- Returns:
- current value
-
getLocation
Return current value associated with the property corresponding toPlatformComponentState.getLocation().- Returns:
- current value
-
getMemory
Return current value associated with the property corresponding toPlatformComponentMemoryState.getMemory().- Returns:
- current value
-
getMfgDate
Return current value associated with the property corresponding toPlatformComponentState.getMfgDate().- Returns:
- current value
-
getMfgName
Return current value associated with the property corresponding toPlatformComponentState.getMfgName().- Returns:
- current value
-
getName
Return current value associated with the property corresponding toPlatformComponentConfig.getName().- Returns:
- current value
-
getOperStatus
Return current value associated with the property corresponding toPlatformComponentState.getOperStatus().- Returns:
- current value
-
getParent
Return current value associated with the property corresponding toState.getParent().- Returns:
- current value
-
getPartNo
Return current value associated with the property corresponding toPlatformComponentState.getPartNo().- Returns:
- current value
-
getRemovable
Return current value associated with the property corresponding toPlatformComponentState.getRemovable().- Returns:
- current value
-
getSerialNo
Return current value associated with the property corresponding toPlatformComponentState.getSerialNo().- Returns:
- current value
-
getSoftwareVersion
Return current value associated with the property corresponding toPlatformComponentState.getSoftwareVersion().- Returns:
- current value
-
getTemperature
Return current value associated with the property corresponding toPlatformComponentTempState.getTemperature().- Returns:
- current value
-
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
Set the property corresponding toPlatformComponentPowerState.getAllocatedPower()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setDescription
Set the property corresponding toPlatformComponentState.getDescription()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setEmpty
Set the property corresponding toPlatformComponentState.getEmpty()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setFirmwareVersion
Set the property corresponding toPlatformComponentState.getFirmwareVersion()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setHardwareVersion
Set the property corresponding toPlatformComponentState.getHardwareVersion()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setId
Set the property corresponding toPlatformComponentState.getId()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setLocation
Set the property corresponding toPlatformComponentState.getLocation()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setMemory
Set the property corresponding toPlatformComponentMemoryState.getMemory()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setMfgDate
Set the property corresponding toPlatformComponentState.getMfgDate()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setMfgName
Set the property corresponding toPlatformComponentState.getMfgName()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setName
Set the property corresponding toPlatformComponentConfig.getName()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setOperStatus
Set the property corresponding toPlatformComponentState.getOperStatus()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setParent
Set the property corresponding toState.getParent()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setPartNo
Set the property corresponding toPlatformComponentState.getPartNo()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setRemovable
Set the property corresponding toPlatformComponentState.getRemovable()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setSerialNo
Set the property corresponding toPlatformComponentState.getSerialNo()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setSoftwareVersion
Set the property corresponding toPlatformComponentState.getSoftwareVersion()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setTemperature
Set the property corresponding toPlatformComponentTempState.getTemperature()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setType
Set the property corresponding toPlatformComponentState.getType()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setUsedPower
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
-
build
A newStateinstance.- Returns:
- A new
Stateinstance.
-