Class WXMCommandExecution.Builder

java.lang.Object
com.io7m.waxmill.machines.WXMCommandExecution.Builder
Enclosing class:
WXMCommandExecution

public static final class WXMCommandExecution.Builder
extends java.lang.Object
Builds instances of type WXMCommandExecution. Initialize attributes and then invoke the build() method to create an immutable instance.

Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

  • Method Details

    • from

      public final WXMCommandExecution.Builder from​(WXMCommandExecutionType instance)
      Fill a builder with attribute values from the provided WXMCommandExecutionType instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • setExecutable

      public final WXMCommandExecution.Builder setExecutable​(java.nio.file.Path executable)
      Initializes the value for the executable attribute.
      Parameters:
      executable - The value for executable
      Returns:
      this builder for use in a chained invocation
    • addArguments

      public final WXMCommandExecution.Builder addArguments​(java.lang.String element)
      Adds one element to arguments list.
      Parameters:
      element - A arguments element
      Returns:
      this builder for use in a chained invocation
    • addArguments

      public final WXMCommandExecution.Builder addArguments​(java.lang.String... elements)
      Adds elements to arguments list.
      Parameters:
      elements - An array of arguments elements
      Returns:
      this builder for use in a chained invocation
    • setArguments

      public final WXMCommandExecution.Builder setArguments​(java.lang.Iterable<java.lang.String> elements)
      Sets or replaces all elements for arguments list.
      Parameters:
      elements - An iterable of arguments elements
      Returns:
      this builder for use in a chained invocation
    • addAllArguments

      public final WXMCommandExecution.Builder addAllArguments​(java.lang.Iterable<java.lang.String> elements)
      Adds elements to arguments list.
      Parameters:
      elements - An iterable of arguments elements
      Returns:
      this builder for use in a chained invocation
    • build

      public WXMCommandExecution build()
      Builds a new WXMCommandExecution.
      Returns:
      An immutable instance of WXMCommandExecution
      Throws:
      java.lang.IllegalStateException - if any required attributes are missing