T - the type of value emitted downstreampublic interface Downstream<T>
Downstreams connect to upstreams.
Once connected, an upstream will invoke only one of either the success(T), error(java.lang.Throwable) or complete() methods exactly once.
Promise.transform(ratpack.func.Function)| Modifier and Type | Method and Description |
|---|---|
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(com.google.common.util.concurrent.ListenableFuture<? extends T> future)
Sends the result of the future downstream.
|
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> |
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.
|
void success(T value)
value - the upstream valuevoid error(java.lang.Throwable throwable)
throwable - what went wrongvoid complete()
default <O> Downstream<O> onSuccess(Action<? super O> action)
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.
O - the type of item acceptedaction - the implementation of the success signal receiver for the returned downstreamdefault Downstream<T> onError(Action<? super java.lang.Throwable> action)
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.
action - the implementation of the error signal receiver for the returned downstreamdefault Downstream<T> onComplete(Block block)
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.
block - the implementation of the complete signal receiver for the returned downstreamdefault void accept(ExecResult<? extends T> result)
result - the result to signaldefault void accept(Result<? extends T> result)
result - the result to signaldefault void accept(java.util.concurrent.CompletionStage<? extends T> completionStage)
completionStage - the CompletionStage to consume the value ofdefault void accept(com.google.common.util.concurrent.ListenableFuture<? extends T> future)
future - the future to consume the value ofdefault <I extends T,A> java.nio.channels.CompletionHandler<I,A> completionHandler()
CompletionHandler that connects to this downstream.