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 classBuilds instances of typeImmutableExecHelper.Nested classes/interfaces inherited from class pl.poznan.put.utility.ExecHelper
ExecHelper.ExecutionResult -
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableExecHelper.Builderbuilder()Creates a builder forImmutableExecHelper.command()static ImmutableExecHelpercopyOf(ExecHelper instance) Creates an immutable copy of aExecHelpervalue.booleanThis instance is equal to all instances ofImmutableExecHelperthat have equal attribute values.inthashCode()Computes a hash code from attributes:workingDirectory,command,environment,arguments.toString()Prints the immutable valueExecHelperwith attribute values.final ImmutableExecHelperwithArguments(Iterable<String> elements) Copy the current immutable object with elements that replace the content ofarguments.final ImmutableExecHelperwithArguments(String... elements) Copy the current immutable object with elements that replace the content ofarguments.final ImmutableExecHelperwithCommand(String value) Copy the current immutable object by setting a value for thecommandattribute.final ImmutableExecHelperwithEnvironment(Map<String, ? extends String> entries) Copy the current immutable object by replacing theenvironmentmap with the specified map.final ImmutableExecHelperwithWorkingDirectory(File value) Copy the current immutable object by setting a present value for the optionalworkingDirectoryattribute.final ImmutableExecHelperwithWorkingDirectory(Optional<? extends File> optional) Copy the current immutable object by setting an optional value for theworkingDirectoryattribute.Methods inherited from class pl.poznan.put.utility.ExecHelper
createRandomDirectory, execute
-
Method Details
-
workingDirectory
- Specified by:
workingDirectoryin classExecHelper- Returns:
- The working directory where to run the command in.
-
command
- Specified by:
commandin classExecHelper- Returns:
- The command to run.
-
environment
- Overrides:
environmentin classExecHelper- Returns:
- The environment variables to be set during external command running (default: empty).
-
arguments
- Overrides:
argumentsin classExecHelper- Returns:
- The list of arguments to the command (default: empty).
-
withWorkingDirectory
Copy the current immutable object by setting a present value for the optionalworkingDirectoryattribute.- Parameters:
value- The value for workingDirectory- Returns:
- A modified copy of
thisobject
-
withWorkingDirectory
Copy the current immutable object by setting an optional value for theworkingDirectoryattribute. 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
thisobject
-
withCommand
Copy the current immutable object by setting a value for thecommandattribute. 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
thisobject
-
withEnvironment
Copy the current immutable object by replacing theenvironmentmap 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
thisobject
-
withArguments
Copy the current immutable object with elements that replace the content ofarguments.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
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
thisobject
-
equals
This instance is equal to all instances ofImmutableExecHelperthat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:workingDirectory,command,environment,arguments. -
toString
Prints the immutable valueExecHelperwith attribute values. -
copyOf
Creates an immutable copy of aExecHelpervalue. 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) // optionalworkingDirectory.command(String) // requiredcommand.putEnvironment|putAllEnvironment(String => String) //environmentmappings .addArguments|addAllArguments(String) //argumentselements .build();- Returns:
- A new ImmutableExecHelper builder
-