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 ofExecHelper.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 Classes Modifier and Type Class Description static classImmutableExecutionResult.BuilderBuilds instances of typeImmutableExecutionResult.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableExecutionResult.Builderbuilder()Creates a builder forImmutableExecutionResult.static ImmutableExecutionResultcopyOf(ExecHelper.ExecutionResult instance)Creates an immutable copy of aExecHelper.ExecutionResultvalue.booleanequals(Object another)This instance is equal to all instances ofImmutableExecutionResultthat have equal attribute values.intexitCode()inthashCode()Computes a hash code from attributes:exitCode,standardOutput,standardError.static ImmutableExecutionResultof(int exitCode, String standardOutput, String standardError)Construct a new immutableExecutionResultinstance.StringstandardError()StringstandardOutput()StringtoString()Prints the immutable valueExecutionResultwith attribute values.ImmutableExecutionResultwithExitCode(int value)Copy the current immutable object by setting a value for theexitCodeattribute.ImmutableExecutionResultwithStandardError(String value)Copy the current immutable object by setting a value for thestandardErrorattribute.ImmutableExecutionResultwithStandardOutput(String value)Copy the current immutable object by setting a value for thestandardOutputattribute.
-
-
-
Method Detail
-
exitCode
public int exitCode()
- Specified by:
exitCodein interfaceExecHelper.ExecutionResult- Returns:
- The exit code (0 means success).
-
standardOutput
public String standardOutput()
- Specified by:
standardOutputin interfaceExecHelper.ExecutionResult- Returns:
- The contents of standard output stream.
-
standardError
public String standardError()
- Specified by:
standardErrorin interfaceExecHelper.ExecutionResult- Returns:
- The contents of standard error stream.
-
withExitCode
public final ImmutableExecutionResult withExitCode(int value)
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
public final ImmutableExecutionResult withStandardOutput(String value)
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
public final ImmutableExecutionResult withStandardError(String value)
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
public boolean equals(@Nullable Object another)
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
public String 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
public static ImmutableExecutionResult copyOf(ExecHelper.ExecutionResult instance)
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
public static ImmutableExecutionResult.Builder builder()
Creates a builder forImmutableExecutionResult.ImmutableExecutionResult.builder() .exitCode(int) // requiredexitCode.standardOutput(String) // requiredstandardOutput.standardError(String) // requiredstandardError.build();- Returns:
- A new ImmutableExecutionResult builder
-
-