Interface StateFuture<T>

    • Method Detail

      • thenApply

        <U> StateFuture<U> thenApply​(FunctionWithException<? super T,​? extends U,​? extends Exception> fn)
        Returns a new StateFuture that, when this future completes normally, is executed with this future's result as the argument to the supplied function.
        Type Parameters:
        U - the function's return type.
        Parameters:
        fn - the function to use to compute the value of the returned StateFuture.
        Returns:
        the new StateFuture.
      • thenAccept

        StateFuture<Void> thenAccept​(ThrowingConsumer<? super T,​? extends Exception> action)
        Returns a new StateFuture that, when this future completes normally, is executed with this future's result as the argument to the supplied action.
        Parameters:
        action - the action to perform before completing the returned StateFuture.
        Returns:
        the new StateFuture.
      • thenCompose

        <U> StateFuture<U> thenCompose​(FunctionWithException<? super T,​? extends StateFuture<U>,​? extends Exception> action)
        Returns a new future that, when this future completes normally, is executed with this future as the argument to the supplied function.
        Parameters:
        action - the action to perform.
        Returns:
        the new StateFuture.
      • thenCombine

        <U,​V> StateFuture<V> thenCombine​(StateFuture<? extends U> other,
                                               BiFunctionWithException<? super T,​? super U,​? extends V,​? extends Exception> fn)
        Returns a new StateFuture that, when this and the other given future both complete normally, is executed with the two results as arguments to the supplied function.
        Type Parameters:
        U - the type of the other StateFuture's result.
        V - the function's return type.
        Parameters:
        other - the other StateFuture.
        fn - the function to use to compute the value of the returned StateFuture.
        Returns:
        the new StateFuture.
      • thenConditionallyApply

        <U,​V> StateFuture<Tuple2<Boolean,​Object>> thenConditionallyApply​(FunctionWithException<? super T,​Boolean,​? extends Exception> condition,
                                                                                     FunctionWithException<? super T,​? extends U,​? extends Exception> actionIfTrue,
                                                                                     FunctionWithException<? super T,​? extends V,​? extends Exception> actionIfFalse)
        Apply a condition test on the result of this StateFuture, and try to perform one action out of two based on the result. Gather the results of the condition test and the selected action into a StateFuture of tuple. The relationship between the action result and the returned new StateFuture are just like the thenApply(FunctionWithException).
        Type Parameters:
        U - the type of the output from actionIfTrue.
        V - the type of the output from actionIfFalse.
        Parameters:
        condition - the condition test.
        actionIfTrue - the function to apply if the condition returns true.
        actionIfFalse - the function to apply if the condition returns false.
        Returns:
        the new StateFuture with the result of condition test, and result of action.
      • thenConditionallyApply

        <U> StateFuture<Tuple2<Boolean,​U>> thenConditionallyApply​(FunctionWithException<? super T,​Boolean,​? extends Exception> condition,
                                                                        FunctionWithException<? super T,​? extends U,​? extends Exception> actionIfTrue)
        Apply a condition test on the result of this StateFuture, and try to perform the action if test result is true. Gather the results of the condition test and the action (if applied) into a StateFuture of tuple. The relationship between the action result and the returned new StateFuture are just like the thenApply(FunctionWithException).
        Type Parameters:
        U - the type of the output from actionIfTrue.
        Parameters:
        condition - the condition test.
        actionIfTrue - the function to apply if the condition returns true.
        Returns:
        the new StateFuture with the result of condition test, and result of action.
      • thenConditionallyAccept

        StateFuture<Boolean> thenConditionallyAccept​(FunctionWithException<? super T,​Boolean,​? extends Exception> condition,
                                                     ThrowingConsumer<? super T,​? extends Exception> actionIfTrue,
                                                     ThrowingConsumer<? super T,​? extends Exception> actionIfFalse)
        Apply a condition test on the result of this StateFuture, and try to perform one action out of two based on the result. Gather the results of the condition test StateFuture.
        Parameters:
        condition - the condition test.
        actionIfTrue - the function to apply if the condition returns true.
        actionIfFalse - the function to apply if the condition returns false.
        Returns:
        the new StateFuture.
      • thenConditionallyAccept

        StateFuture<Boolean> thenConditionallyAccept​(FunctionWithException<? super T,​Boolean,​? extends Exception> condition,
                                                     ThrowingConsumer<? super T,​? extends Exception> actionIfTrue)
        Apply a condition test on the result of this StateFuture, and try to perform the action if test result is true. Gather the results of the condition test StateFuture.
        Parameters:
        condition - the condition test.
        actionIfTrue - the function to apply if the condition returns true.
        Returns:
        the new StateFuture.
      • thenConditionallyCompose

        <U,​V> StateFuture<Tuple2<Boolean,​Object>> thenConditionallyCompose​(FunctionWithException<? super T,​Boolean,​? extends Exception> condition,
                                                                                       FunctionWithException<? super T,​? extends StateFuture<U>,​? extends Exception> actionIfTrue,
                                                                                       FunctionWithException<? super T,​? extends StateFuture<V>,​? extends Exception> actionIfFalse)
        Apply a condition test on the result of this StateFuture, and try to perform one action out of two based on the result. Gather the results of the condition test and the selected action into a StateFuture of tuple. The relationship between the action result and the returned new StateFuture are just like the thenCompose(FunctionWithException).
        Type Parameters:
        U - the type of the output from actionIfTrue.
        V - the type of the output from actionIfFalse.
        Parameters:
        condition - the condition test.
        actionIfTrue - the function to apply if the condition returns true.
        actionIfFalse - the function to apply if the condition returns false.
        Returns:
        the new StateFuture with the result of condition test, and result of action.
      • thenConditionallyCompose

        <U> StateFuture<Tuple2<Boolean,​U>> thenConditionallyCompose​(FunctionWithException<? super T,​Boolean,​? extends Exception> condition,
                                                                          FunctionWithException<? super T,​? extends StateFuture<U>,​? extends Exception> actionIfTrue)
        Apply a condition test on the result of this StateFuture, and try to perform the action if test result is true. Gather the results of the condition test and the action (if applied) into a StateFuture of tuple. The relationship between the action result and the returned new StateFuture are just like the thenCompose(FunctionWithException) (FunctionWithException)}.
        Type Parameters:
        U - the type of the output from actionIfTrue.
        Parameters:
        condition - the condition test.
        actionIfTrue - the function to apply if the condition returns true.
        Returns:
        the new StateFuture with the result of condition test, and result of action.