Class ImmutableMultiSelections.Builder
java.lang.Object
net.bmahe.genetics4j.core.spec.selection.ImmutableMultiSelections.Builder
- Enclosing class:
ImmutableMultiSelections
Builds instances of type
ImmutableMultiSelections
.
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 TypeMethodDescriptionaddAllSelectionPolicies
(Iterable<? extends SelectionPolicy> elements) Adds elements toselectionPolicies
list.addSelectionPolicies
(SelectionPolicy element) Adds one element toselectionPolicies
list.addSelectionPolicies
(SelectionPolicy... elements) Adds elements toselectionPolicies
list.build()
Builds a newImmutableMultiSelections
.from
(MultiSelections instance) Fill a builder with attribute values from the providedMultiSelections
instance.selectionPolicies
(Iterable<? extends SelectionPolicy> elements) Sets or replaces all elements forselectionPolicies
list.
-
Field Details
-
selectionPolicies
-
-
Constructor Details
-
Builder
private Builder()
-
-
Method Details
-
from
Fill a builder with attribute values from the providedMultiSelections
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
-
addSelectionPolicies
Adds one element toselectionPolicies
list.- Parameters:
element
- A selectionPolicies element- Returns:
this
builder for use in a chained invocation
-
addSelectionPolicies
Adds elements toselectionPolicies
list.- Parameters:
elements
- An array of selectionPolicies elements- Returns:
this
builder for use in a chained invocation
-
selectionPolicies
public final ImmutableMultiSelections.Builder selectionPolicies(Iterable<? extends SelectionPolicy> elements) Sets or replaces all elements forselectionPolicies
list.- Parameters:
elements
- An iterable of selectionPolicies elements- Returns:
this
builder for use in a chained invocation
-
addAllSelectionPolicies
public final ImmutableMultiSelections.Builder addAllSelectionPolicies(Iterable<? extends SelectionPolicy> elements) Adds elements toselectionPolicies
list.- Parameters:
elements
- An iterable of selectionPolicies elements- Returns:
this
builder for use in a chained invocation
-
build
Builds a newImmutableMultiSelections
.- Returns:
- An immutable instance of MultiSelections
- Throws:
IllegalStateException
- if any required attributes are missing
-