Package pl.poznan.put.utility
Class ImmutableExecHelper.Builder
- java.lang.Object
-
- pl.poznan.put.utility.ImmutableExecHelper.Builder
-
- Enclosing class:
- ImmutableExecHelper
@NotThreadSafe public static final class ImmutableExecHelper.Builder extends Object
Builds instances of typeImmutableExecHelper. Initialize attributes and then invoke thebuild()method to create an immutable instance.Builderis not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableExecHelper.BuilderaddAllArguments(Iterable<String> elements)Adds elements toargumentslist.ImmutableExecHelper.BuilderaddArguments(String element)Adds one element toargumentslist.ImmutableExecHelper.BuilderaddArguments(String... elements)Adds elements toargumentslist.ImmutableExecHelper.Builderarguments(Iterable<String> elements)Sets or replaces all elements forargumentslist.ImmutableExecHelperbuild()Builds a newImmutableExecHelper.ImmutableExecHelper.Buildercommand(String command)Initializes the value for thecommandattribute.ImmutableExecHelper.Builderenvironment(Map<String,? extends String> entries)Sets or replaces all mappings from the specified map as entries for theenvironmentmap.ImmutableExecHelper.Builderfrom(ExecHelper instance)Fill a builder with attribute values from the providedExecHelperinstance.ImmutableExecHelper.BuilderputAllEnvironment(Map<String,? extends String> entries)Put all mappings from the specified map as entries toenvironmentmap.ImmutableExecHelper.BuilderputEnvironment(String key, String value)Put one entry to theenvironmentmap.ImmutableExecHelper.BuilderputEnvironment(Map.Entry<String,? extends String> entry)Put one entry to theenvironmentmap.ImmutableExecHelper.BuilderworkingDirectory(File workingDirectory)Initializes the optional valueworkingDirectoryto workingDirectory.ImmutableExecHelper.BuilderworkingDirectory(Optional<? extends File> workingDirectory)Initializes the optional valueworkingDirectoryto workingDirectory.
-
-
-
Method Detail
-
from
public final ImmutableExecHelper.Builder from(ExecHelper instance)
Fill a builder with attribute values from the providedExecHelperinstance. 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
-
workingDirectory
public final ImmutableExecHelper.Builder workingDirectory(File workingDirectory)
Initializes the optional valueworkingDirectoryto workingDirectory.- Parameters:
workingDirectory- The value for workingDirectory- Returns:
thisbuilder for chained invocation
-
workingDirectory
public final ImmutableExecHelper.Builder workingDirectory(Optional<? extends File> workingDirectory)
Initializes the optional valueworkingDirectoryto workingDirectory.- Parameters:
workingDirectory- The value for workingDirectory- Returns:
thisbuilder for use in a chained invocation
-
command
public final ImmutableExecHelper.Builder command(String command)
Initializes the value for thecommandattribute.- Parameters:
command- The value for command- Returns:
thisbuilder for use in a chained invocation
-
putEnvironment
public final ImmutableExecHelper.Builder putEnvironment(String key, 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 ImmutableExecHelper.Builder putEnvironment(Map.Entry<String,? extends 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
-
environment
public final ImmutableExecHelper.Builder environment(Map<String,? extends 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 ImmutableExecHelper.Builder putAllEnvironment(Map<String,? extends 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
-
addArguments
public final ImmutableExecHelper.Builder addArguments(String element)
Adds one element toargumentslist.- Parameters:
element- A arguments element- Returns:
thisbuilder for use in a chained invocation
-
addArguments
public final ImmutableExecHelper.Builder addArguments(String... elements)
Adds elements toargumentslist.- Parameters:
elements- An array of arguments elements- Returns:
thisbuilder for use in a chained invocation
-
arguments
public final ImmutableExecHelper.Builder arguments(Iterable<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 ImmutableExecHelper.Builder addAllArguments(Iterable<String> elements)
Adds elements toargumentslist.- Parameters:
elements- An iterable of arguments elements- Returns:
thisbuilder for use in a chained invocation
-
build
public ImmutableExecHelper build()
Builds a newImmutableExecHelper.- Returns:
- An immutable instance of ExecHelper
- Throws:
IllegalStateException- if any required attributes are missing
-
-