Package io.karatelabs.process
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionargs()Returns the value of theargsrecord component.static ProcessConfigdefaults()env()Returns the value of theenvrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theerrorListenerrecord component.final inthashCode()Returns a hash code value for this object.listener()Returns the value of thelistenerrecord component.booleanReturns the value of thelogToContextrecord component.booleanReturns the value of theredirectErrorStreamrecord component.timeout()Returns the value of thetimeoutrecord component.final StringtoString()Returns a string representation of this record class.booleanuseShell()Returns the value of theuseShellrecord component.Returns the value of theworkingDirrecord component.
-
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 aProcessConfigrecord class.- Parameters:
args- the value for theargsrecord componentworkingDir- the value for theworkingDirrecord componentenv- the value for theenvrecord componentuseShell- the value for theuseShellrecord componentredirectErrorStream- the value for theredirectErrorStreamrecord componenttimeout- the value for thetimeoutrecord componentlistener- the value for thelistenerrecord componenterrorListener- the value for theerrorListenerrecord componentlogToContext- the value for thelogToContextrecord component
-
-
Method Details
-
defaults
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
args
Returns the value of theargsrecord component.- Returns:
- the value of the
argsrecord component
-
workingDir
Returns the value of theworkingDirrecord component.- Returns:
- the value of the
workingDirrecord component
-
env
Returns the value of theenvrecord component.- Returns:
- the value of the
envrecord component
-
useShell
public boolean useShell()Returns the value of theuseShellrecord component.- Returns:
- the value of the
useShellrecord component
-
redirectErrorStream
public boolean redirectErrorStream()Returns the value of theredirectErrorStreamrecord component.- Returns:
- the value of the
redirectErrorStreamrecord component
-
timeout
Returns the value of thetimeoutrecord component.- Returns:
- the value of the
timeoutrecord component
-
listener
Returns the value of thelistenerrecord component.- Returns:
- the value of the
listenerrecord component
-
errorListener
Returns the value of theerrorListenerrecord component.- Returns:
- the value of the
errorListenerrecord component
-
logToContext
public boolean logToContext()Returns the value of thelogToContextrecord component.- Returns:
- the value of the
logToContextrecord component
-