Package pl.poznan.put.utility
Class ImmutableExecHelper
java.lang.Object
pl.poznan.put.utility.ExecHelper
pl.poznan.put.utility.ImmutableExecHelper
@ParametersAreNonnullByDefault
@Generated("org.immutables.processor.ProxyProcessor")
@Immutable
public final class ImmutableExecHelper
extends ExecHelper
Immutable implementation of
ExecHelper
.
Use the builder to create immutable instances:
ImmutableExecHelper.builder()
.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Builds instances of typeImmutableExecHelper
.Nested classes/interfaces inherited from class pl.poznan.put.utility.ExecHelper
ExecHelper.ExecutionResult
-
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableExecHelper.Builder
builder()
Creates a builder forImmutableExecHelper
.command()
static ImmutableExecHelper
copyOf
(ExecHelper instance) Creates an immutable copy of aExecHelper
value.boolean
This instance is equal to all instances ofImmutableExecHelper
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:workingDirectory
,command
,environment
,arguments
.toString()
Prints the immutable valueExecHelper
with attribute values.final ImmutableExecHelper
withArguments
(Iterable<String> elements) Copy the current immutable object with elements that replace the content ofarguments
.final ImmutableExecHelper
withArguments
(String... elements) Copy the current immutable object with elements that replace the content ofarguments
.final ImmutableExecHelper
withCommand
(String value) Copy the current immutable object by setting a value for thecommand
attribute.final ImmutableExecHelper
withEnvironment
(Map<String, ? extends String> entries) Copy the current immutable object by replacing theenvironment
map with the specified map.final ImmutableExecHelper
withWorkingDirectory
(File value) Copy the current immutable object by setting a present value for the optionalworkingDirectory
attribute.final ImmutableExecHelper
withWorkingDirectory
(Optional<? extends File> optional) Copy the current immutable object by setting an optional value for theworkingDirectory
attribute.Methods inherited from class pl.poznan.put.utility.ExecHelper
createRandomDirectory, execute
-
Method Details
-
workingDirectory
- Specified by:
workingDirectory
in classExecHelper
- Returns:
- The working directory where to run the command in.
-
command
- Specified by:
command
in classExecHelper
- Returns:
- The command to run.
-
environment
- Overrides:
environment
in classExecHelper
- Returns:
- The environment variables to be set during external command running (default: empty).
-
arguments
- Overrides:
arguments
in classExecHelper
- Returns:
- The list of arguments to the command (default: empty).
-
withWorkingDirectory
Copy the current immutable object by setting a present value for the optionalworkingDirectory
attribute.- Parameters:
value
- The value for workingDirectory- Returns:
- A modified copy of
this
object
-
withWorkingDirectory
Copy the current immutable object by setting an optional value for theworkingDirectory
attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returningthis
.- Parameters:
optional
- A value for workingDirectory- Returns:
- A modified copy of
this
object
-
withCommand
Copy the current immutable object by setting a value for thecommand
attribute. An equals check used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for command- Returns:
- A modified copy of the
this
object
-
withEnvironment
Copy the current immutable object by replacing theenvironment
map with the specified map. Nulls are not permitted as keys or values. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
entries
- The entries to be added to the environment map- Returns:
- A modified copy of
this
object
-
withArguments
Copy the current immutable object with elements that replace the content ofarguments
.- Parameters:
elements
- The elements to set- Returns:
- A modified copy of
this
object
-
withArguments
Copy the current immutable object with elements that replace the content ofarguments
. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
elements
- An iterable of arguments elements to set- Returns:
- A modified copy of
this
object
-
equals
This instance is equal to all instances ofImmutableExecHelper
that have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:workingDirectory
,command
,environment
,arguments
. -
toString
Prints the immutable valueExecHelper
with attribute values. -
copyOf
Creates an immutable copy of aExecHelper
value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance
- The instance to copy- Returns:
- A copied immutable ExecHelper instance
-
builder
Creates a builder forImmutableExecHelper
.ImmutableExecHelper.builder() .workingDirectory(java.io.File) // optional
workingDirectory
.command(String) // requiredcommand
.putEnvironment|putAllEnvironment(String => String) //environment
mappings .addArguments|addAllArguments(String) //arguments
elements .build();- Returns:
- A new ImmutableExecHelper builder
-