Class ImmutableExecHelper.Builder

java.lang.Object
pl.poznan.put.utility.ImmutableExecHelper.Builder
Enclosing class:
ImmutableExecHelper

@NotThreadSafe public static final class ImmutableExecHelper.Builder extends Object
Builds instances of type ImmutableExecHelper. 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 ImmutableExecHelper.Builder from(ExecHelper instance)
      Fill a builder with attribute values from the provided ExecHelper 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
    • workingDirectory

      public final ImmutableExecHelper.Builder workingDirectory(File workingDirectory)
      Initializes the optional value workingDirectory to workingDirectory.
      Parameters:
      workingDirectory - The value for workingDirectory
      Returns:
      this builder for chained invocation
    • workingDirectory

      public final ImmutableExecHelper.Builder workingDirectory(Optional<? extends File> workingDirectory)
      Initializes the optional value workingDirectory to workingDirectory.
      Parameters:
      workingDirectory - The value for workingDirectory
      Returns:
      this builder for use in a chained invocation
    • command

      public final ImmutableExecHelper.Builder command(String command)
      Initializes the value for the command attribute.
      Parameters:
      command - The value for command
      Returns:
      this builder for use in a chained invocation
    • putEnvironment

      public final ImmutableExecHelper.Builder putEnvironment(String key, 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 ImmutableExecHelper.Builder putEnvironment(Map.Entry<String,? extends 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
    • environment

      public final ImmutableExecHelper.Builder environment(Map<String,? extends 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 ImmutableExecHelper.Builder putAllEnvironment(Map<String,? extends 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
    • addArguments

      public final ImmutableExecHelper.Builder addArguments(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 ImmutableExecHelper.Builder addArguments(String... elements)
      Adds elements to arguments list.
      Parameters:
      elements - An array of arguments elements
      Returns:
      this builder for use in a chained invocation
    • arguments

      public final ImmutableExecHelper.Builder arguments(Iterable<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 ImmutableExecHelper.Builder addAllArguments(Iterable<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 ImmutableExecHelper build()
      Builds a new ImmutableExecHelper.
      Returns:
      An immutable instance of ExecHelper
      Throws:
      IllegalStateException - if any required attributes are missing