Package ratpack.exec

Interface Downstream<T>

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default void accept​(com.google.common.util.concurrent.ListenableFuture<? extends T> future)
      Sends the result of the future downstream.
      default void accept​(java.util.concurrent.CompletionStage<? extends T> completionStage)
      Sends the result of a CompletionStage downstream.
      default void accept​(ExecResult<? extends T> result)
      Signals this downstream, based on the given result.
      default void accept​(Result<? extends T> result)
      Signals this downstream, based on the given result.
      void complete()
      Signals that the upstream will not be providing a value, as it has terminated.
      default <I extends T,​A>
      java.nio.channels.CompletionHandler<I,​A>
      completionHandler()
      Creates a JDK CompletionHandler that connects to this downstream.
      void error​(java.lang.Throwable throwable)
      Signals the unsuccessful production of the upstream value.
      default Downstream<T> onComplete​(Block block)
      Wrap this downstream, using the given action as the implementation of the complete() method.
      default Downstream<T> onError​(Action<? super java.lang.Throwable> action)
      Wrap this downstream, using the given action as the implementation of the error(Throwable) method.
      default <O> Downstream<O> onSuccess​(Action<? super O> action)
      Wrap this downstream, using the given action as the implementation of the success(T) method.
      void success​(T value)
      Signals the successful production of the upstream value.
    • Method Detail

      • success

        void success​(T value)
        Signals the successful production of the upstream value.
        Parameters:
        value - the upstream value
      • error

        void error​(java.lang.Throwable throwable)
        Signals the unsuccessful production of the upstream value.
        Parameters:
        throwable - what went wrong
      • complete

        void complete()
        Signals that the upstream will not be providing a value, as it has terminated.
      • onSuccess

        default <O> Downstream<O> onSuccess​(Action<? super O> action)
        Wrap this downstream, using the given action as the implementation of the success(T) method.

        All error(java.lang.Throwable) and complete() signals will be forwarded to this downstream, and the given action called with the value if success(T) is signalled.

        Type Parameters:
        O - the type of item accepted
        Parameters:
        action - the implementation of the success signal receiver for the returned downstream
        Returns:
        a downstream
      • onError

        default Downstream<T> onError​(Action<? super java.lang.Throwable> action)
        Wrap this downstream, using the given action as the implementation of the error(Throwable) method.

        All success(T) and complete() signals will be forwarded to this downstream, and the given action called with the value if success(T) is signalled.

        Parameters:
        action - the implementation of the error signal receiver for the returned downstream
        Returns:
        a downstream
      • onComplete

        default Downstream<T> onComplete​(Block block)
        Wrap this downstream, using the given action as the implementation of the complete() method.

        All success(T) and error(java.lang.Throwable) signals will be forwarded to this downstream, and the given action called with the value if complete() is signalled.

        Parameters:
        block - the implementation of the complete signal receiver for the returned downstream
        Returns:
        a downstream
      • accept

        default void accept​(ExecResult<? extends T> result)
        Signals this downstream, based on the given result.
        Parameters:
        result - the result to signal
      • accept

        default void accept​(Result<? extends T> result)
        Signals this downstream, based on the given result.
        Parameters:
        result - the result to signal
      • accept

        default void accept​(java.util.concurrent.CompletionStage<? extends T> completionStage)
        Sends the result of a CompletionStage downstream.
        Parameters:
        completionStage - the CompletionStage to consume the value of
      • accept

        default void accept​(com.google.common.util.concurrent.ListenableFuture<? extends T> future)
        Sends the result of the future downstream.
        Parameters:
        future - the future to consume the value of
      • completionHandler

        default <I extends T,​A> java.nio.channels.CompletionHandler<I,​A> completionHandler()
        Creates a JDK CompletionHandler that connects to this downstream.
        Returns:
        a completion handler
        Since:
        1.2