Package pl.poznan.put.utility
Class ImmutableExecHelper.Builder
java.lang.Object
pl.poznan.put.utility.ImmutableExecHelper.Builder
- Enclosing class:
- ImmutableExecHelper
Builds instances of type
ImmutableExecHelper.
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 TypeMethodDescriptionaddAllArguments(Iterable<String> elements) Adds elements toargumentslist.addArguments(String element) Adds one element toargumentslist.addArguments(String... elements) Adds elements toargumentslist.Sets or replaces all elements forargumentslist.build()Builds a newImmutableExecHelper.Initializes the value for thecommandattribute.environment(Map<String, ? extends String> entries) Sets or replaces all mappings from the specified map as entries for theenvironmentmap.from(ExecHelper instance) Fill a builder with attribute values from the providedExecHelperinstance.putAllEnvironment(Map<String, ? extends String> entries) Put all mappings from the specified map as entries toenvironmentmap.putEnvironment(String key, String value) Put one entry to theenvironmentmap.putEnvironment(Map.Entry<String, ? extends String> entry) Put one entry to theenvironmentmap.workingDirectory(File workingDirectory) Initializes the optional valueworkingDirectoryto workingDirectory.workingDirectory(Optional<? extends File> workingDirectory) Initializes the optional valueworkingDirectoryto workingDirectory.
-
Method Details
-
from
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
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
Initializes the value for thecommandattribute.- Parameters:
command- The value for command- Returns:
thisbuilder for use in a chained invocation
-
putEnvironment
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
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
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
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
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
-
arguments
Sets or replaces all elements forargumentslist.- Parameters:
elements- An iterable of arguments elements- Returns:
thisbuilder for use in a chained invocation
-
addAllArguments
Adds elements toargumentslist.- Parameters:
elements- An iterable of arguments elements- Returns:
thisbuilder for use in a chained invocation
-
build
Builds a newImmutableExecHelper.- Returns:
- An immutable instance of ExecHelper
- Throws:
IllegalStateException- if any required attributes are missing
-