Package com.io7m.waxmill.process.api
Class WXMProcessDescription.Builder
java.lang.Object
com.io7m.waxmill.process.api.WXMProcessDescription.Builder
- Enclosing class:
- WXMProcessDescription
public static final class WXMProcessDescription.Builder
extends java.lang.Object
Builds instances of type
WXMProcessDescription
.
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.
-
Method Summary
Modifier and Type Method Description WXMProcessDescription.Builder
addAllArguments(java.lang.Iterable<java.lang.String> elements)
Adds elements toarguments
list.WXMProcessDescription.Builder
addArguments(java.lang.String element)
Adds one element toarguments
list.WXMProcessDescription.Builder
addArguments(java.lang.String... elements)
Adds elements toarguments
list.WXMProcessDescription
build()
Builds a newWXMProcessDescription
.WXMProcessDescription.Builder
from(WXMProcessDescriptionType instance)
Fill a builder with attribute values from the providedWXMProcessDescriptionType
instance.WXMProcessDescription.Builder
putAllEnvironment(java.util.Map<java.lang.String,? extends java.lang.String> entries)
Put all mappings from the specified map as entries toenvironment
map.WXMProcessDescription.Builder
putEnvironment(java.lang.String key, java.lang.String value)
Put one entry to theenvironment
map.WXMProcessDescription.Builder
putEnvironment(java.util.Map.Entry<java.lang.String,? extends java.lang.String> entry)
Put one entry to theenvironment
map.WXMProcessDescription.Builder
setArguments(java.lang.Iterable<java.lang.String> elements)
Sets or replaces all elements forarguments
list.WXMProcessDescription.Builder
setEnvironment(java.util.Map<java.lang.String,? extends java.lang.String> entries)
Sets or replaces all mappings from the specified map as entries for theenvironment
map.WXMProcessDescription.Builder
setExecutable(java.nio.file.Path executable)
Initializes the value for theexecutable
attribute.
-
Method Details
-
from
Fill a builder with attribute values from the providedWXMProcessDescriptionType
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
-
setExecutable
Initializes the value for theexecutable
attribute.- Parameters:
executable
- The value for executable- Returns:
this
builder for use in a chained invocation
-
addArguments
Adds one element toarguments
list.- Parameters:
element
- A arguments element- Returns:
this
builder for use in a chained invocation
-
addArguments
Adds elements toarguments
list.- Parameters:
elements
- An array of arguments elements- Returns:
this
builder for use in a chained invocation
-
setArguments
public final WXMProcessDescription.Builder setArguments(java.lang.Iterable<java.lang.String> elements)Sets or replaces all elements forarguments
list.- Parameters:
elements
- An iterable of arguments elements- Returns:
this
builder for use in a chained invocation
-
addAllArguments
public final WXMProcessDescription.Builder addAllArguments(java.lang.Iterable<java.lang.String> elements)Adds elements toarguments
list.- Parameters:
elements
- An iterable of arguments elements- Returns:
this
builder for use in a chained invocation
-
putEnvironment
public final WXMProcessDescription.Builder putEnvironment(java.lang.String key, java.lang.String value)Put one entry to theenvironment
map.- Parameters:
key
- The key in the environment mapvalue
- The associated value in the environment map- Returns:
this
builder for use in a chained invocation
-
putEnvironment
public final WXMProcessDescription.Builder putEnvironment(java.util.Map.Entry<java.lang.String,? extends java.lang.String> entry)Put one entry to theenvironment
map. Nulls are not permitted- Parameters:
entry
- The key and value entry- Returns:
this
builder for use in a chained invocation
-
setEnvironment
public final WXMProcessDescription.Builder setEnvironment(java.util.Map<java.lang.String,? extends java.lang.String> entries)Sets or replaces all mappings from the specified map as entries for theenvironment
map. Nulls are not permitted- Parameters:
entries
- The entries that will be added to the environment map- Returns:
this
builder for use in a chained invocation
-
putAllEnvironment
public final WXMProcessDescription.Builder putAllEnvironment(java.util.Map<java.lang.String,? extends java.lang.String> entries)Put all mappings from the specified map as entries toenvironment
map. Nulls are not permitted- Parameters:
entries
- The entries that will be added to the environment map- Returns:
this
builder for use in a chained invocation
-
build
Builds a newWXMProcessDescription
.- Returns:
- An immutable instance of WXMProcessDescription
- Throws:
java.lang.IllegalStateException
- if any required attributes are missing
-