Class ShardResultBuilder
- java.lang.Object
-
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.shard.result.output.ShardResultBuilder
-
- All Implemented Interfaces:
Builder<ShardResult>
,CheckedBuilder<ShardResult,IllegalArgumentException>
,Mutable
,MutationBehaviour<Mutable>
public class ShardResultBuilder extends Object implements Builder<ShardResult>
Class that buildsShardResultBuilder
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:
ShardResultBuilder createTarget(int fooXyzzy, int barBaz) { return new ShardResultBuilderBuilder() .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build()) .setBar(new BarBuilder().setBaz(barBaz).build()) .build(); }
This pattern is supported by the immutable nature of ShardResultBuilder, 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:
ShardResultBuilder
,Builder
-
-
Constructor Summary
Constructors Constructor Description ShardResultBuilder()
ShardResultBuilder(DatastoreShardId arg)
ShardResultBuilder(ShardResult base)
ShardResultBuilder(ShardOperationResult arg)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ShardResultBuilder
addAugmentation(Augmentation<ShardResult> augmentation)
Add an augmentation to this builder's product.<E$$ extends Augmentation<ShardResult>>
E$$augmentation(Class<E$$> augmentationType)
ShardResult
build()
void
fieldsFrom(DataObject arg)
Set fields from given grouping argument.DataStoreType
getDataStoreType()
String
getErrorMessage()
String
getShardName()
Boolean
isSucceeded()
ShardResultKey
key()
ShardResultBuilder
removeAugmentation(Class<? extends Augmentation<ShardResult>> augmentationType)
Remove an augmentation from this builder's product.ShardResultBuilder
setDataStoreType(DataStoreType value)
ShardResultBuilder
setErrorMessage(String value)
ShardResultBuilder
setShardName(String value)
ShardResultBuilder
setSucceeded(Boolean value)
ShardResultBuilder
withKey(ShardResultKey key)
-
-
-
Constructor Detail
-
ShardResultBuilder
public ShardResultBuilder()
-
ShardResultBuilder
public ShardResultBuilder(ShardOperationResult arg)
-
ShardResultBuilder
public ShardResultBuilder(DatastoreShardId arg)
-
ShardResultBuilder
public ShardResultBuilder(ShardResult base)
-
-
Method Detail
-
fieldsFrom
public void fieldsFrom(DataObject arg)
Set fields from given grouping argument. Valid argument is instance of one of following types:- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.ShardOperationResult
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.DatastoreShardId
- Parameters:
arg
- grouping object- Throws:
IllegalArgumentException
- if given argument is none of valid types
-
key
public ShardResultKey key()
-
getDataStoreType
public DataStoreType getDataStoreType()
-
getErrorMessage
public String getErrorMessage()
-
getShardName
public String getShardName()
-
isSucceeded
public Boolean isSucceeded()
-
augmentation
public <E$$ extends Augmentation<ShardResult>> E$$ augmentation(Class<E$$> augmentationType)
-
withKey
public ShardResultBuilder withKey(ShardResultKey key)
-
setDataStoreType
public ShardResultBuilder setDataStoreType(DataStoreType value)
-
setErrorMessage
public ShardResultBuilder setErrorMessage(String value)
-
setShardName
public ShardResultBuilder setShardName(String value)
-
setSucceeded
public ShardResultBuilder setSucceeded(Boolean value)
-
addAugmentation
public ShardResultBuilder addAugmentation(Augmentation<ShardResult> augmentation)
Add an augmentation to this builder's product.- Parameters:
augmentation
- augmentation to be added- Returns:
- this builder
- Throws:
NullPointerException
- ifaugmentation
is null
-
removeAugmentation
public ShardResultBuilder removeAugmentation(Class<? extends Augmentation<ShardResult>> 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 ShardResult build()
- Specified by:
build
in interfaceBuilder<ShardResult>
- Specified by:
build
in interfaceCheckedBuilder<ShardResult,IllegalArgumentException>
-
-