Package ratpack.exec
Interface Result<T>
-
- Type Parameters:
T
- The type of the successful result object
- All Known Subinterfaces:
ExecResult<T>
public interface Result<T>
The result of an asynchronous operation, which may be an error.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static <T> Result<T>
error(Throwable error)
Creates a new error result.Throwable
getThrowable()
The error exception.T
getValue()
The result value.default T
getValueOrThrow()
Returns the value if this is a success result, or throws the exception if it's an error.boolean
isError()
True if this was an error result.boolean
isSuccess()
True if this was a success result.static <T> Result<T>
success(T value)
Creates a new successful result.
-
-
-
Method Detail
-
success
static <T> Result<T> success(T value)
Creates a new successful result.- Type Parameters:
T
- the type of the result- Parameters:
value
- the result value- Returns:
- the success result
-
error
static <T> Result<T> error(Throwable error)
Creates a new error result.- Type Parameters:
T
- the type of the result- Parameters:
error
- the error- Returns:
- the error result
-
getThrowable
Throwable getThrowable()
The error exception.- Returns:
- The error exception, or null if the result was not an error.
-
getValue
T getValue()
The result value.- Returns:
- The result value, or null if the result was not success.
-
isSuccess
boolean isSuccess()
True if this was a success result.- Returns:
- whether the result is success.
-
isError
boolean isError()
True if this was an error result.- Returns:
- whether the result is an error.
-
-