Package net.bmahe.genetics4j.gp
Class ImmutableInputSpec.Builder
java.lang.Object
net.bmahe.genetics4j.gp.ImmutableInputSpec.Builder
- Enclosing class:
ImmutableInputSpec
Builds instances of type
ImmutableInputSpec
.
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 TypeMethodDescriptionaddAllTypes
(Iterable<? extends Class> elements) Adds elements totypes
list.Adds one element totypes
list.Adds elements totypes
list.build()
Builds a newImmutableInputSpec
.Fill a builder with attribute values from the providedInputSpec
instance.Sets or replaces all elements fortypes
list.
-
Field Details
-
types
-
-
Constructor Details
-
Builder
private Builder()
-
-
Method Details
-
from
Fill a builder with attribute values from the providedInputSpec
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
-
addTypes
Adds one element totypes
list.- Parameters:
element
- A types element- Returns:
this
builder for use in a chained invocation
-
addTypes
Adds elements totypes
list.- Parameters:
elements
- An array of types elements- Returns:
this
builder for use in a chained invocation
-
types
Sets or replaces all elements fortypes
list.- Parameters:
elements
- An iterable of types elements- Returns:
this
builder for use in a chained invocation
-
addAllTypes
Adds elements totypes
list.- Parameters:
elements
- An iterable of types elements- Returns:
this
builder for use in a chained invocation
-
build
Builds a newImmutableInputSpec
.- Returns:
- An immutable instance of InputSpec
- Throws:
IllegalStateException
- if any required attributes are missing
-