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.
  • 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

      public final WXMCommandExecution withExecutable​(java.nio.file.Path value)
      Copy the current immutable object by setting a value for the executable attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for executable
      Returns:
      A modified copy of the this object
    • withArguments

      public final WXMCommandExecution withArguments​(java.lang.String... elements)
      Copy the current immutable object with elements that replace the content of arguments.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withArguments

      public final WXMCommandExecution withArguments​(java.lang.Iterable<java.lang.String> elements)
      Copy the current immutable object with elements that replace the content of arguments. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of arguments elements to set
      Returns:
      A modified copy of this object
    • withIgnoreFailure

      public final WXMCommandExecution withIgnoreFailure​(boolean value)
      Copy the current immutable object by setting a value for the ignoreFailure attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for ignoreFailure
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals​(java.lang.Object another)
      This instance is equal to all instances of WXMCommandExecution that have equal attribute values.
      Overrides:
      equals in class java.lang.Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: executable, arguments, ignoreFailure.
      Overrides:
      hashCode in class java.lang.Object
      Returns:
      hashCode value
    • copyOf

      public static WXMCommandExecution copyOf​(WXMCommandExecutionType instance)
      Creates an immutable copy of a WXMCommandExecutionType 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 WXMCommandExecution instance
    • builder

      public static WXMCommandExecution.Builder builder()
      Creates a builder for WXMCommandExecution.
       WXMCommandExecution.builder()
          .setExecutable(java.nio.file.Path) // required executable
          .addArguments|addAllArguments(String) // arguments elements
          .setIgnoreFailure(boolean) // optional ignoreFailure
          .build();
       
      Returns:
      A new WXMCommandExecution builder