Package pl.poznan.put.utility
Class ImmutableExecutionResult
java.lang.Object
pl.poznan.put.utility.ImmutableExecutionResult
- All Implemented Interfaces:
ExecHelper.ExecutionResult
@ParametersAreNonnullByDefault
@Generated("org.immutables.processor.ProxyProcessor")
@Immutable
public final class ImmutableExecutionResult
extends Object
implements ExecHelper.ExecutionResult
Immutable implementation of
ExecHelper.ExecutionResult
.
Use the builder to create immutable instances:
ImmutableExecutionResult.builder()
.
Use the static factory method to create immutable instances:
ImmutableExecutionResult.of()
.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Builds instances of typeImmutableExecutionResult
. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Creates a builder forImmutableExecutionResult
.static ImmutableExecutionResult
copyOf
(ExecHelper.ExecutionResult instance) Creates an immutable copy of aExecHelper.ExecutionResult
value.boolean
This instance is equal to all instances ofImmutableExecutionResult
that have equal attribute values.int
exitCode()
int
hashCode()
Computes a hash code from attributes:exitCode
,standardOutput
,standardError
.static ImmutableExecutionResult
Construct a new immutableExecutionResult
instance.toString()
Prints the immutable valueExecutionResult
with attribute values.final ImmutableExecutionResult
withExitCode
(int value) Copy the current immutable object by setting a value for theexitCode
attribute.final ImmutableExecutionResult
withStandardError
(String value) Copy the current immutable object by setting a value for thestandardError
attribute.final ImmutableExecutionResult
withStandardOutput
(String value) Copy the current immutable object by setting a value for thestandardOutput
attribute.
-
Method Details
-
exitCode
public int exitCode()- Specified by:
exitCode
in interfaceExecHelper.ExecutionResult
- Returns:
- The exit code (0 means success).
-
standardOutput
- Specified by:
standardOutput
in interfaceExecHelper.ExecutionResult
- Returns:
- The contents of standard output stream.
-
standardError
- Specified by:
standardError
in interfaceExecHelper.ExecutionResult
- Returns:
- The contents of standard error stream.
-
withExitCode
Copy the current immutable object by setting a value for theexitCode
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for exitCode- Returns:
- A modified copy of the
this
object
-
withStandardOutput
Copy the current immutable object by setting a value for thestandardOutput
attribute. An equals check used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for standardOutput- Returns:
- A modified copy of the
this
object
-
withStandardError
Copy the current immutable object by setting a value for thestandardError
attribute. An equals check used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for standardError- Returns:
- A modified copy of the
this
object
-
equals
This instance is equal to all instances ofImmutableExecutionResult
that have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:exitCode
,standardOutput
,standardError
. -
toString
Prints the immutable valueExecutionResult
with attribute values. -
of
public static ImmutableExecutionResult of(int exitCode, String standardOutput, String standardError) Construct a new immutableExecutionResult
instance.- Parameters:
exitCode
- The value for theexitCode
attributestandardOutput
- The value for thestandardOutput
attributestandardError
- The value for thestandardError
attribute- Returns:
- An immutable ExecutionResult instance
-
copyOf
Creates an immutable copy of aExecHelper.ExecutionResult
value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance
- The instance to copy- Returns:
- A copied immutable ExecutionResult instance
-
builder
Creates a builder forImmutableExecutionResult
.ImmutableExecutionResult.builder() .exitCode(int) // required
exitCode
.standardOutput(String) // requiredstandardOutput
.standardError(String) // requiredstandardError
.build();- Returns:
- A new ImmutableExecutionResult builder
-