Class ImmutableMultiMutations.Builder
java.lang.Object
net.bmahe.genetics4j.core.spec.mutation.ImmutableMultiMutations.Builder
- Enclosing class:
ImmutableMultiMutations
Builds instances of type
ImmutableMultiMutations
.
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 TypeMethodDescriptionaddAllMutationPolicies
(Iterable<? extends MutationPolicy> elements) Adds elements tomutationPolicies
list.addMutationPolicies
(MutationPolicy element) Adds one element tomutationPolicies
list.addMutationPolicies
(MutationPolicy... elements) Adds elements tomutationPolicies
list.build()
Builds a newImmutableMultiMutations
.from
(MultiMutations instance) Fill a builder with attribute values from the providedMultiMutations
instance.mutationPolicies
(Iterable<? extends MutationPolicy> elements) Sets or replaces all elements formutationPolicies
list.
-
Field Details
-
mutationPolicies
-
-
Constructor Details
-
Builder
private Builder()
-
-
Method Details
-
from
Fill a builder with attribute values from the providedMultiMutations
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
-
addMutationPolicies
Adds one element tomutationPolicies
list.- Parameters:
element
- A mutationPolicies element- Returns:
this
builder for use in a chained invocation
-
addMutationPolicies
Adds elements tomutationPolicies
list.- Parameters:
elements
- An array of mutationPolicies elements- Returns:
this
builder for use in a chained invocation
-
mutationPolicies
public final ImmutableMultiMutations.Builder mutationPolicies(Iterable<? extends MutationPolicy> elements) Sets or replaces all elements formutationPolicies
list.- Parameters:
elements
- An iterable of mutationPolicies elements- Returns:
this
builder for use in a chained invocation
-
addAllMutationPolicies
public final ImmutableMultiMutations.Builder addAllMutationPolicies(Iterable<? extends MutationPolicy> elements) Adds elements tomutationPolicies
list.- Parameters:
elements
- An iterable of mutationPolicies elements- Returns:
this
builder for use in a chained invocation
-
build
Builds a newImmutableMultiMutations
.- Returns:
- An immutable instance of MultiMutations
- Throws:
IllegalStateException
- if any required attributes are missing
-