Record Class ProcessConfig

java.lang.Object
java.lang.Record
io.karatelabs.process.ProcessConfig

public record ProcessConfig(List<String> args, Path workingDir, Map<String,String> env, boolean useShell, boolean redirectErrorStream, Duration timeout, Consumer<String> listener, Consumer<String> errorListener, boolean logToContext) extends Record
Immutable configuration for process execution. Created via ProcessBuilder, consumed by ProcessHandle.
  • Constructor Details

    • ProcessConfig

      public ProcessConfig(List<String> args, Path workingDir, Map<String,String> env, boolean useShell, boolean redirectErrorStream, Duration timeout, Consumer<String> listener, Consumer<String> errorListener, boolean logToContext)
      Creates an instance of a ProcessConfig record class.
      Parameters:
      args - the value for the args record component
      workingDir - the value for the workingDir record component
      env - the value for the env record component
      useShell - the value for the useShell record component
      redirectErrorStream - the value for the redirectErrorStream record component
      timeout - the value for the timeout record component
      listener - the value for the listener record component
      errorListener - the value for the errorListener record component
      logToContext - the value for the logToContext record component
  • Method Details

    • defaults

      public static ProcessConfig defaults()
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • args

      public List<String> args()
      Returns the value of the args record component.
      Returns:
      the value of the args record component
    • workingDir

      public Path workingDir()
      Returns the value of the workingDir record component.
      Returns:
      the value of the workingDir record component
    • env

      public Map<String,String> env()
      Returns the value of the env record component.
      Returns:
      the value of the env record component
    • useShell

      public boolean useShell()
      Returns the value of the useShell record component.
      Returns:
      the value of the useShell record component
    • redirectErrorStream

      public boolean redirectErrorStream()
      Returns the value of the redirectErrorStream record component.
      Returns:
      the value of the redirectErrorStream record component
    • timeout

      public Duration timeout()
      Returns the value of the timeout record component.
      Returns:
      the value of the timeout record component
    • listener

      public Consumer<String> listener()
      Returns the value of the listener record component.
      Returns:
      the value of the listener record component
    • errorListener

      public Consumer<String> errorListener()
      Returns the value of the errorListener record component.
      Returns:
      the value of the errorListener record component
    • logToContext

      public boolean logToContext()
      Returns the value of the logToContext record component.
      Returns:
      the value of the logToContext record component