Class ImmutableMultiStageDescriptor.Builder
java.lang.Object
net.bmahe.genetics4j.gpu.spec.fitness.multistage.ImmutableMultiStageDescriptor.Builder
- Enclosing class:
ImmutableMultiStageDescriptor
Builds instances of type
ImmutableMultiStageDescriptor
.
Initialize attributes and then invoke the build()
method to create an
immutable instance.
Builder
is not thread-safe and generally should not be stored in a field or collection,
but instead used immediately to create instances.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List
<StageDescriptor> private Map
<String, StaticDataLoader> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddAllStageDescriptors
(Iterable<? extends StageDescriptor> elements) Adds elements tostageDescriptors
list.addStageDescriptors
(StageDescriptor element) Adds one element tostageDescriptors
list.addStageDescriptors
(StageDescriptor... elements) Adds elements tostageDescriptors
list.build()
Builds a newImmutableMultiStageDescriptor
.from
(MultiStageDescriptor instance) Fill a builder with attribute values from the providedMultiStageDescriptor
instance.putAllStaticDataLoaders
(Map<String, ? extends StaticDataLoader> entries) Put all mappings from the specified map as entries tostaticDataLoaders
map.putStaticDataLoaders
(String key, StaticDataLoader value) Put one entry to thestaticDataLoaders
map.putStaticDataLoaders
(Map.Entry<String, ? extends StaticDataLoader> entry) Put one entry to thestaticDataLoaders
map.stageDescriptors
(Iterable<? extends StageDescriptor> elements) Sets or replaces all elements forstageDescriptors
list.staticDataLoaders
(Map<String, ? extends StaticDataLoader> entries) Sets or replaces all mappings from the specified map as entries for thestaticDataLoaders
map.
-
Field Details
-
staticDataLoaders
-
stageDescriptors
-
-
Constructor Details
-
Builder
private Builder()
-
-
Method Details
-
from
Fill a builder with attribute values from the providedMultiStageDescriptor
instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.- Parameters:
instance
- The instance from which to copy values- Returns:
this
builder for use in a chained invocation
-
putStaticDataLoaders
public final ImmutableMultiStageDescriptor.Builder putStaticDataLoaders(String key, StaticDataLoader value) Put one entry to thestaticDataLoaders
map.- Parameters:
key
- The key in the staticDataLoaders mapvalue
- The associated value in the staticDataLoaders map- Returns:
this
builder for use in a chained invocation
-
putStaticDataLoaders
public final ImmutableMultiStageDescriptor.Builder putStaticDataLoaders(Map.Entry<String, ? extends StaticDataLoader> entry) Put one entry to thestaticDataLoaders
map. Nulls are not permitted- Parameters:
entry
- The key and value entry- Returns:
this
builder for use in a chained invocation
-
staticDataLoaders
public final ImmutableMultiStageDescriptor.Builder staticDataLoaders(Map<String, ? extends StaticDataLoader> entries) Sets or replaces all mappings from the specified map as entries for thestaticDataLoaders
map. Nulls are not permitted- Parameters:
entries
- The entries that will be added to the staticDataLoaders map- Returns:
this
builder for use in a chained invocation
-
putAllStaticDataLoaders
public final ImmutableMultiStageDescriptor.Builder putAllStaticDataLoaders(Map<String, ? extends StaticDataLoader> entries) Put all mappings from the specified map as entries tostaticDataLoaders
map. Nulls are not permitted- Parameters:
entries
- The entries that will be added to the staticDataLoaders map- Returns:
this
builder for use in a chained invocation
-
addStageDescriptors
Adds one element tostageDescriptors
list.- Parameters:
element
- A stageDescriptors element- Returns:
this
builder for use in a chained invocation
-
addStageDescriptors
Adds elements tostageDescriptors
list.- Parameters:
elements
- An array of stageDescriptors elements- Returns:
this
builder for use in a chained invocation
-
stageDescriptors
public final ImmutableMultiStageDescriptor.Builder stageDescriptors(Iterable<? extends StageDescriptor> elements) Sets or replaces all elements forstageDescriptors
list.- Parameters:
elements
- An iterable of stageDescriptors elements- Returns:
this
builder for use in a chained invocation
-
addAllStageDescriptors
public final ImmutableMultiStageDescriptor.Builder addAllStageDescriptors(Iterable<? extends StageDescriptor> elements) Adds elements tostageDescriptors
list.- Parameters:
elements
- An iterable of stageDescriptors elements- Returns:
this
builder for use in a chained invocation
-
build
Builds a newImmutableMultiStageDescriptor
.- Returns:
- An immutable instance of MultiStageDescriptor
- Throws:
IllegalStateException
- if any required attributes are missing
-