Class WXMProcessDescription.Builder

java.lang.Object
com.io7m.waxmill.process.api.WXMProcessDescription.Builder
Enclosing class:
WXMProcessDescription

public static final class WXMProcessDescription.Builder
extends java.lang.Object
Builds instances of type WXMProcessDescription. 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

      Fill a builder with attribute values from the provided WXMProcessDescriptionType 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 WXMProcessDescription.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 WXMProcessDescription.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 WXMProcessDescription.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 WXMProcessDescription.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 WXMProcessDescription.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
    • putEnvironment

      public final WXMProcessDescription.Builder putEnvironment​(java.lang.String key, java.lang.String value)
      Put one entry to the environment map.
      Parameters:
      key - The key in the environment map
      value - The associated value in the environment map
      Returns:
      this builder for use in a chained invocation
    • putEnvironment

      public final WXMProcessDescription.Builder putEnvironment​(java.util.Map.Entry<java.lang.String,​? extends java.lang.String> entry)
      Put one entry to the environment map. Nulls are not permitted
      Parameters:
      entry - The key and value entry
      Returns:
      this builder for use in a chained invocation
    • setEnvironment

      public final WXMProcessDescription.Builder setEnvironment​(java.util.Map<java.lang.String,​? extends java.lang.String> entries)
      Sets or replaces all mappings from the specified map as entries for the environment map. Nulls are not permitted
      Parameters:
      entries - The entries that will be added to the environment map
      Returns:
      this builder for use in a chained invocation
    • putAllEnvironment

      public final WXMProcessDescription.Builder putAllEnvironment​(java.util.Map<java.lang.String,​? extends java.lang.String> entries)
      Put all mappings from the specified map as entries to environment map. Nulls are not permitted
      Parameters:
      entries - The entries that will be added to the environment map
      Returns:
      this builder for use in a chained invocation
    • build

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