public class MultiOnItem<T> extends Object
| Constructor and Description |
|---|
MultiOnItem(Multi<T> upstream) |
| Modifier and Type | Method and Description |
|---|---|
<R> Multi<R> |
apply(Function<? super T,? extends R> mapper)
|
<O> Multi<O> |
castTo(Class<O> target)
Produces an
Multi emitting the item events based on the upstream events but casted to the target class. |
<O> Multi<O> |
disjoint()
Takes the items from the upstream
Multi that are either Publisher<O>,
O[], Iterable<O> or Multi<O> and
disjoint the items to obtain a Multi<O>. |
Multi<Void> |
ignore()
Ignores the passed items.
|
Uni<Void> |
ignoreAsUni()
Ignores the passed items.
|
Multi<T> |
invoke(Consumer<T> callback)
Produces a new
Multi invoking the given callback when an item event is fired by the upstrea. |
Multi<T> |
invokeUni(Function<? super T,? extends Uni<?>> action)
Produces a new
Multi invoking the given @{code action} when an item event is received. |
<O> MultiFlatten<T,O> |
produceCompletionStage(Function<? super T,? extends CompletionStage<? extends O>> mapper)
Configures the mapper of the flatMap operation.
|
<O> MultiFlatten<T,O> |
produceIterable(Function<? super T,? extends Iterable<? extends O>> mapper)
Configures the mapper of the flatMap operation.
|
<O> MultiFlatten<T,O> |
produceMulti(Function<? super T,? extends org.reactivestreams.Publisher<? extends O>> mapper)
Configures the mapper of the flatMap operation.
|
<O> MultiFlatten<T,O> |
producePublisher(Function<? super T,? extends org.reactivestreams.Publisher<? extends O>> mapper)
Configures the mapper of the flatMap operation.
|
<O> MultiFlatten<T,O> |
produceUni(Function<? super T,? extends Uni<? extends O>> mapper)
Configures the mapper of the flatMap operation.
|
Multi<T> |
scan(BinaryOperator<T> accumulator)
|
<S> Multi<S> |
scan(Supplier<S> initialStateProducer,
BiFunction<S,? super T,S> accumulator)
|
public <R> Multi<R> apply(Function<? super T,? extends R> mapper)
Multi invoking the given function for each item emitted by the upstream Multi.
The function receives the received item as parameter, and can transform it. The returned object is sent
downstream as item event.
R - the type of item produced by the mapper functionmapper - the mapper function, must not be nullMultipublic Multi<T> invoke(Consumer<T> callback)
Multi invoking the given callback when an item event is fired by the upstrea.callback - the callback, must not be nullUnipublic Multi<T> invokeUni(Function<? super T,? extends Uni<?>> action)
Multi invoking the given @{code action} when an item event is received. Note that
the received item cannot be null.
Unlike invoke(Consumer), the passed function returns a Uni. When the produced Uni sends
its result, the result is discarded, and the original item is forwarded downstream. If the produced
Uni fails, the failure is propagated downstream.
If the asynchronous action throws an exception, this exception is propagated downstream.
This method preserves the order of the items, meaning that the downstream received the items in the same order
as the upstream has emitted them.
public <O> Multi<O> disjoint()
Multi that are either Publisher<O>,
O[], Iterable<O> or Multi<O> and
disjoint the items to obtain a Multi<O>.
For example, Multi<[A, B, C], [D, E, F] is transformed into Multi<A, B, C, D, E, F>.
If the items from upstream are not instances of Iterable, Publisher or array, an
IllegalArgumentException is propagated downstream.
O - the type items contained in the upstream's items.public <O> MultiFlatten<T,O> produceMulti(Function<? super T,? extends org.reactivestreams.Publisher<? extends O>> mapper)
multi and is called for each item emitted by the upstream Multi.O - the type of item emitted by the Multi produced by the mapper.mapper - the mapper, must not be null, must not produce nullpublic <O> MultiFlatten<T,O> producePublisher(Function<? super T,? extends org.reactivestreams.Publisher<? extends O>> mapper)
publisher and is called for each item emitted by the upstream Multi.O - the type of item emitted by the Publisher produced by the mapper.mapper - the mapper, must not be null, must not produce nullpublic <O> MultiFlatten<T,O> produceIterable(Function<? super T,? extends Iterable<? extends O>> mapper)
iterable and is called for each item emitted by the upstream Multi.O - the type of item contained by the Iterable produced by the mapper.mapper - the mapper, must not be null, must not produce nullpublic <O> MultiFlatten<T,O> produceUni(Function<? super T,? extends Uni<? extends O>> mapper)
uni and is called for each item emitted by the upstream Multi.O - the type of item emitted by the Uni produced by the mapper.mapper - the mapper, must not be null, must not produce nullpublic <O> MultiFlatten<T,O> produceCompletionStage(Function<? super T,? extends CompletionStage<? extends O>> mapper)
CompletionStage and is called for each item emitted by the upstream Multi.O - the type of item emitted by the CompletionStage produced by the mapper.mapper - the mapper, must not be null, must not produce nullpublic Multi<Void> ignore()
Multi will only be notified when the stream completes or fails.public Uni<Void> ignoreAsUni()
Uni will only be completed with null when the stream
completes or with a failure if the upstream emits a failure..public <O> Multi<O> castTo(Class<O> target)
Multi emitting the item events based on the upstream events but casted to the target class.O - the type of item emitted by the produced unitarget - the target classpublic <S> Multi<S> scan(Supplier<S> initialStateProducer, BiFunction<S,? super T,S> accumulator)
Multi that fires items coming from the reduction of the item emitted by this current
Multi by the passed accumulator reduction function. The produced multi emits the intermediate
results.
Unlike scan(BinaryOperator), this operator uses the value produced by the initialStateProducer as
first value.
S - the type of item emitted by the produced Multi. It's the type returned by the
accumulator operation.initialStateProducer - the producer called to provides the initial value passed to the accumulator operation.accumulator - the reduction BiFunction, the resulting Multi emits the results of
this method. The method is called for every item emitted by this Multi.Multipublic Multi<T> scan(BinaryOperator<T> accumulator)
Multi that fires results coming from the reduction of the item emitted by this current
Multi by the passed accumulator reduction function. The produced multi emits the intermediate
results.
Unlike scan(Supplier, BiFunction), this operator doesn't take an initial value but takes the first
item emitted by this Multi as initial value.
accumulator - the reduction BiFunction, the resulting Multi emits the results of this method.
The method is called for every item emitted by this Multi.MultiCopyright © 2019–2020 SmallRye. All rights reserved.