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 classBuilds instances of typeImmutableExecutionResult. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a builder forImmutableExecutionResult.static ImmutableExecutionResultcopyOf(ExecHelper.ExecutionResult instance) Creates an immutable copy of aExecHelper.ExecutionResultvalue.booleanThis instance is equal to all instances ofImmutableExecutionResultthat have equal attribute values.intexitCode()inthashCode()Computes a hash code from attributes:exitCode,standardOutput,standardError.static ImmutableExecutionResultConstruct a new immutableExecutionResultinstance.toString()Prints the immutable valueExecutionResultwith attribute values.final ImmutableExecutionResultwithExitCode(int value) Copy the current immutable object by setting a value for theexitCodeattribute.final ImmutableExecutionResultwithStandardError(String value) Copy the current immutable object by setting a value for thestandardErrorattribute.final ImmutableExecutionResultwithStandardOutput(String value) Copy the current immutable object by setting a value for thestandardOutputattribute.
-
Method Details
-
exitCode
public int exitCode()- Specified by:
exitCodein interfaceExecHelper.ExecutionResult- Returns:
- The exit code (0 means success).
-
standardOutput
- Specified by:
standardOutputin interfaceExecHelper.ExecutionResult- Returns:
- The contents of standard output stream.
-
standardError
- Specified by:
standardErrorin interfaceExecHelper.ExecutionResult- Returns:
- The contents of standard error stream.
-
withExitCode
Copy the current immutable object by setting a value for theexitCodeattribute. 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
thisobject
-
withStandardOutput
Copy the current immutable object by setting a value for thestandardOutputattribute. 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
thisobject
-
withStandardError
Copy the current immutable object by setting a value for thestandardErrorattribute. 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
thisobject
-
equals
This instance is equal to all instances ofImmutableExecutionResultthat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:exitCode,standardOutput,standardError. -
toString
Prints the immutable valueExecutionResultwith attribute values. -
of
public static ImmutableExecutionResult of(int exitCode, String standardOutput, String standardError) Construct a new immutableExecutionResultinstance.- Parameters:
exitCode- The value for theexitCodeattributestandardOutput- The value for thestandardOutputattributestandardError- The value for thestandardErrorattribute- Returns:
- An immutable ExecutionResult instance
-
copyOf
Creates an immutable copy of aExecHelper.ExecutionResultvalue. 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) // requiredexitCode.standardOutput(String) // requiredstandardOutput.standardError(String) // requiredstandardError.build();- Returns:
- A new ImmutableExecutionResult builder
-