Class ImmutableMultiCombinations.Builder
java.lang.Object
net.bmahe.genetics4j.core.spec.combination.ImmutableMultiCombinations.Builder
- Enclosing class:
ImmutableMultiCombinations
Builds instances of type
ImmutableMultiCombinations
.
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddAllCombinationPolicies
(Iterable<? extends CombinationPolicy> elements) Adds elements tocombinationPolicies
list.addCombinationPolicies
(CombinationPolicy element) Adds one element tocombinationPolicies
list.addCombinationPolicies
(CombinationPolicy... elements) Adds elements tocombinationPolicies
list.build()
Builds a newImmutableMultiCombinations
.combinationPolicies
(Iterable<? extends CombinationPolicy> elements) Sets or replaces all elements forcombinationPolicies
list.from
(MultiCombinations instance) Fill a builder with attribute values from the providedMultiCombinations
instance.
-
Field Details
-
combinationPolicies
-
-
Constructor Details
-
Builder
private Builder()
-
-
Method Details
-
from
Fill a builder with attribute values from the providedMultiCombinations
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
-
addCombinationPolicies
Adds one element tocombinationPolicies
list.- Parameters:
element
- A combinationPolicies element- Returns:
this
builder for use in a chained invocation
-
addCombinationPolicies
public final ImmutableMultiCombinations.Builder addCombinationPolicies(CombinationPolicy... elements) Adds elements tocombinationPolicies
list.- Parameters:
elements
- An array of combinationPolicies elements- Returns:
this
builder for use in a chained invocation
-
combinationPolicies
public final ImmutableMultiCombinations.Builder combinationPolicies(Iterable<? extends CombinationPolicy> elements) Sets or replaces all elements forcombinationPolicies
list.- Parameters:
elements
- An iterable of combinationPolicies elements- Returns:
this
builder for use in a chained invocation
-
addAllCombinationPolicies
public final ImmutableMultiCombinations.Builder addAllCombinationPolicies(Iterable<? extends CombinationPolicy> elements) Adds elements tocombinationPolicies
list.- Parameters:
elements
- An iterable of combinationPolicies elements- Returns:
this
builder for use in a chained invocation
-
build
Builds a newImmutableMultiCombinations
.- Returns:
- An immutable instance of MultiCombinations
- Throws:
IllegalStateException
- if any required attributes are missing
-