Class WXMProcessDescription

java.lang.Object
com.io7m.waxmill.process.api.WXMProcessDescription
All Implemented Interfaces:
WXMProcessDescriptionType

public final class WXMProcessDescription
extends java.lang.Object
implements WXMProcessDescriptionType
A description of a process to be created.
  • Method Details

    • executable

      public java.nio.file.Path executable()
      Specified by:
      executable in interface WXMProcessDescriptionType
      Returns:
      The full path to the executable
    • arguments

      public java.util.List<java.lang.String> arguments()
      Specified by:
      arguments in interface WXMProcessDescriptionType
      Returns:
      The list of arguments passed to the executable
    • environment

      public java.util.Map<java.lang.String,​java.lang.String> environment()
      Specified by:
      environment in interface WXMProcessDescriptionType
      Returns:
      The environment that the new process will use
    • withExecutable

      public final WXMProcessDescription 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 WXMProcessDescription 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 WXMProcessDescription 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
    • withEnvironment

      public final WXMProcessDescription withEnvironment​(java.util.Map<java.lang.String,​? extends java.lang.String> entries)
      Copy the current immutable object by replacing the environment 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 returning this.
      Parameters:
      entries - The entries to be added to the environment map
      Returns:
      A modified copy of this object
    • equals

      public boolean equals​(java.lang.Object another)
      This instance is equal to all instances of WXMProcessDescription 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, environment.
      Overrides:
      hashCode in class java.lang.Object
      Returns:
      hashCode value
    • toString

      public java.lang.String toString()
      Prints the immutable value WXMProcessDescription with attribute values.
      Overrides:
      toString in class java.lang.Object
      Returns:
      A string representation of the value
    • copyOf

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

      public static WXMProcessDescription.Builder builder()
      Creates a builder for WXMProcessDescription.
       WXMProcessDescription.builder()
          .setExecutable(java.nio.file.Path) // required executable
          .addArguments|addAllArguments(String) // arguments elements
          .putEnvironment|putAllEnvironment(String => String) // environment mappings
          .build();
       
      Returns:
      A new WXMProcessDescription builder