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. |
<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 null
Multi
public 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 null
Uni
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 null
public <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 null
public <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 null
public <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 null
public <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 null
public 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.Multi
public 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.Multi
Copyright © 2019–2020 SmallRye. All rights reserved.