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 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​(java.lang.Throwable error)
        Creates a new error result.
        Type Parameters:
        T - the type of the result
        Parameters:
        error - the error
        Returns:
        the error result
      • getThrowable

        java.lang.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.
      • getValueOrThrow

        default T getValueOrThrow()
                           throws java.lang.Exception
        Returns the value if this is a success result, or throws the exception if it's an error.
        Returns:
        the value (if this is a success result)
        Throws:
        java.lang.Exception - the error (if this is an error result)