T - a type of items produced by Valve APIpublic interface Valve<T> extends Pausable
| Modifier and Type | Method and Description |
|---|---|
default <A,R> CompletionStage<R> |
collect(Collector<? super T,A,R> collector)
Returns a
CompletionStage which will be completed when this Valve is completed and result is a collected
value. |
default Valve<T> |
executeOn(ExecutorService executorService)
Returns new
Valve which defer all handlers to provided ExecutorService. |
default Valve<T> |
filter(Predicate<T> predicate)
|
default <K> Valve<K> |
flatMap(Function<T,Valve<K>> mapFunction)
Returns new
Valve instance which combines all results into a single Valve. |
default void |
handle(BiConsumer<T,Pausable> onData)
Register data handlers (callbacks).
|
default void |
handle(BiConsumer<T,Pausable> onData,
Consumer<Throwable> onError)
Register data handlers (callbacks).
|
void |
handle(BiConsumer<T,Pausable> onData,
Consumer<Throwable> onError,
Runnable onComplete)
Register data handlers (callbacks).
|
default void |
handle(Consumer<T> onData)
Register data handlers (callbacks).
|
default void |
handle(Consumer<T> onData,
Consumer<Throwable> onError)
Register data handlers (callbacks).
|
default void |
handle(Consumer<T> onData,
Consumer<Throwable> onError,
Runnable onComplete)
Register data handlers (callbacks).
|
default <K> Valve<K> |
map(Function<T,K> mapper)
|
default Valve<T> |
peek(Consumer<T> action)
|
default ValveIterator<T> |
toIterator()
Transforms this
Valve into ValveIterator representation. |
default Flow.Publisher<T> |
toPublisher()
Transforms this
Valve into Flow.Publisher representation. |
void handle(BiConsumer<T,Pausable> onData, Consumer<Throwable> onError, Runnable onComplete)
onData - a callback for data chunks and Pausable representing a faucet of this Valve.onError - a callback of errors or nullonComplete - a callback for completion event or nullNullPointerException - if onData parameter is nullIllegalStateException - if cannot register new callback. For example if instance accepts only a single handler.default void handle(BiConsumer<T,Pausable> onData)
onData - a callback for data chunks and Pausable representing a faucet of this Valve.NullPointerException - if onData parameter is nullIllegalStateException - if cannot register new callback. For example if instance accepts only a single handler.default void handle(BiConsumer<T,Pausable> onData, Consumer<Throwable> onError)
onData - a callback for data chunks and Pausable representing a faucet of this Valve.onError - a callback of errors or nullNullPointerException - if onData parameter is nullIllegalStateException - if cannot register new callback. For example if instance accepts only a single handler.default void handle(Consumer<T> onData, Consumer<Throwable> onError, Runnable onComplete)
onData - a callback for data chunks.onError - a callback of errors or nullonComplete - a callback for completion event or nullNullPointerException - if onData parameter is nullIllegalStateException - if cannot register new callback. For example if instance accepts only a single handler.default void handle(Consumer<T> onData)
onData - a callback for data chunks.NullPointerException - if onData parameter is nullIllegalStateException - if cannot register new callback. For example if instance accepts only a single handler.default void handle(Consumer<T> onData, Consumer<Throwable> onError)
onData - a callback for data chunks.onError - a callback of errors or nullNullPointerException - if onData parameter is nullIllegalStateException - if cannot register new callback. For example if instance accepts only a single handler.default <K> Valve<K> map(Function<T,K> mapper)
Valve consisting of the results of applying the given function to the elements of this Valve.K - the element type of the new Valvemapper - a stateless function to apply to each elementValvedefault <K> Valve<K> flatMap(Function<T,Valve<K>> mapFunction)
Valve instance which combines all results into a single Valve.
If provided mapFunction returns null then this result is skipped.
default Valve<T> filter(Predicate<T> predicate)
predicate - a stateless predicate to apply to each element to determine if it should be includedValvedefault Valve<T> peek(Consumer<T> action)
Valve consisting of the elements of this Valve, additionally
performing the provided action on each element as elements are consumed from the resulting Valve.action - an action to perform on the elements as they are consumed from the ValveValvedefault <A,R> CompletionStage<R> collect(Collector<? super T,A,R> collector)
CompletionStage which will be completed when this Valve is completed and result is a collected
value.
Result completes exceptionally if this Valve completes exceptionally.
A - the intermediate accumulation type of the CollectorR - the type of the resultcollector - a collector to usedefault Flow.Publisher<T> toPublisher()
Valve into Flow.Publisher representation. Resulting Publisher
accepts only single Flow.Subscriber.Publisher representationdefault Valve<T> executeOn(ExecutorService executorService)
Valve which defer all handlers to provided ExecutorService. Each data chunk will
be still called sequentially.executorService - an executor service to useValve instanceNullPointerException - if executorService parameter is null.default ValveIterator<T> toIterator()
Valve into ValveIterator representation. It transforms reactive approach to the blocking
polling Iterator API.IllegalStateException - if this instance has already registered handlersCopyright © 2018–2019 Oracle Corporation. All rights reserved.