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.BuilderaddAllArguments(java.lang.Iterable<java.lang.String> elements)Adds elements toargumentslist.WXMProcessDescription.BuilderaddArguments(java.lang.String element)Adds one element toargumentslist.WXMProcessDescription.BuilderaddArguments(java.lang.String... elements)Adds elements toargumentslist.WXMProcessDescriptionbuild()Builds a newWXMProcessDescription.WXMProcessDescription.Builderfrom(WXMProcessDescriptionType instance)Fill a builder with attribute values from the providedWXMProcessDescriptionTypeinstance.WXMProcessDescription.BuilderputAllEnvironment(java.util.Map<java.lang.String,? extends java.lang.String> entries)Put all mappings from the specified map as entries toenvironmentmap.WXMProcessDescription.BuilderputEnvironment(java.lang.String key, java.lang.String value)Put one entry to theenvironmentmap.WXMProcessDescription.BuilderputEnvironment(java.util.Map.Entry<java.lang.String,? extends java.lang.String> entry)Put one entry to theenvironmentmap.WXMProcessDescription.BuildersetArguments(java.lang.Iterable<java.lang.String> elements)Sets or replaces all elements forargumentslist.WXMProcessDescription.BuildersetEnvironment(java.util.Map<java.lang.String,? extends java.lang.String> entries)Sets or replaces all mappings from the specified map as entries for theenvironmentmap.WXMProcessDescription.BuildersetExecutable(java.nio.file.Path executable)Initializes the value for theexecutableattribute.
-
Method Details
-
from
Fill a builder with attribute values from the providedWXMProcessDescriptionTypeinstance. 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:
thisbuilder for use in a chained invocation
-
setExecutable
Initializes the value for theexecutableattribute.- Parameters:
executable- The value for executable- Returns:
thisbuilder for use in a chained invocation
-
addArguments
Adds one element toargumentslist.- Parameters:
element- A arguments element- Returns:
thisbuilder for use in a chained invocation
-
addArguments
Adds elements toargumentslist.- Parameters:
elements- An array of arguments elements- Returns:
thisbuilder for use in a chained invocation
-
setArguments
public final WXMProcessDescription.Builder setArguments(java.lang.Iterable<java.lang.String> elements)Sets or replaces all elements forargumentslist.- Parameters:
elements- An iterable of arguments elements- Returns:
thisbuilder for use in a chained invocation
-
addAllArguments
public final WXMProcessDescription.Builder addAllArguments(java.lang.Iterable<java.lang.String> elements)Adds elements toargumentslist.- Parameters:
elements- An iterable of arguments elements- Returns:
thisbuilder for use in a chained invocation
-
putEnvironment
public final WXMProcessDescription.Builder putEnvironment(java.lang.String key, java.lang.String value)Put one entry to theenvironmentmap.- Parameters:
key- The key in the environment mapvalue- The associated value in the environment map- Returns:
thisbuilder 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 theenvironmentmap. Nulls are not permitted- Parameters:
entry- The key and value entry- Returns:
thisbuilder 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 theenvironmentmap. Nulls are not permitted- Parameters:
entries- The entries that will be added to the environment map- Returns:
thisbuilder 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 toenvironmentmap. Nulls are not permitted- Parameters:
entries- The entries that will be added to the environment map- Returns:
thisbuilder 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
-