Package com.io7m.waxmill.machines
Class WXMCommandExecution
java.lang.Object
com.io7m.waxmill.machines.WXMCommandExecutionType
com.io7m.waxmill.machines.WXMCommandExecution
public final class WXMCommandExecution extends WXMCommandExecutionType
An execution of an external command.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWXMCommandExecution.BuilderBuilds instances of typeWXMCommandExecution. -
Method Summary
Modifier and Type Method Description java.util.List<java.lang.String>arguments()static WXMCommandExecution.Builderbuilder()Creates a builder forWXMCommandExecution.static WXMCommandExecutioncopyOf(WXMCommandExecutionType instance)Creates an immutable copy of aWXMCommandExecutionTypevalue.booleanequals(java.lang.Object another)This instance is equal to all instances ofWXMCommandExecutionthat have equal attribute values.java.nio.file.Pathexecutable()inthashCode()Computes a hash code from attributes:executable,arguments,ignoreFailure.booleanignoreFailure()WXMCommandExecutionwithArguments(java.lang.Iterable<java.lang.String> elements)Copy the current immutable object with elements that replace the content ofarguments.WXMCommandExecutionwithArguments(java.lang.String... elements)Copy the current immutable object with elements that replace the content ofarguments.WXMCommandExecutionwithExecutable(java.nio.file.Path value)Copy the current immutable object by setting a value for theexecutableattribute.WXMCommandExecutionwithIgnoreFailure(boolean value)Copy the current immutable object by setting a value for theignoreFailureattribute.
-
Method Details
-
executable
public java.nio.file.Path executable()- Returns:
- The location of the executable
-
arguments
public java.util.List<java.lang.String> arguments()- Returns:
- The list of command-line arguments
-
ignoreFailure
public boolean ignoreFailure()- Returns:
- If the failure of this command should be ignored
-
withExecutable
Copy the current immutable object by setting a value for theexecutableattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for executable- Returns:
- A modified copy of the
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
-
withIgnoreFailure
Copy the current immutable object by setting a value for theignoreFailureattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for ignoreFailure- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(java.lang.Object another)This instance is equal to all instances ofWXMCommandExecutionthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()Computes a hash code from attributes:executable,arguments,ignoreFailure.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
copyOf
Creates an immutable copy of aWXMCommandExecutionTypevalue. 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 WXMCommandExecution instance
-
builder
Creates a builder forWXMCommandExecution.WXMCommandExecution.builder() .setExecutable(java.nio.file.Path) // requiredexecutable.addArguments|addAllArguments(String) //argumentselements .setIgnoreFailure(boolean) // optionalignoreFailure.build();- Returns:
- A new WXMCommandExecution builder
-