Class UniOnNotNull<T>
- java.lang.Object
-
- io.smallrye.mutiny.groups.UniOnNotNull<T>
-
public class UniOnNotNull<T> extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description UniOnNotNull(Uni<T> upstream)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <R> Uni<R>apply(java.util.function.Function<? super T,? extends R> mapper)Deprecated.Uni<T>call(java.util.function.Function<? super T,Uni<?>> action)Produces a newUniinvoking the given @{code action} when theitemevent is received.Uni<T>call(java.util.function.Supplier<Uni<?>> action)Produces a newUniinvoking the given @{code action} when theitemevent is received.Uni<T>invoke(java.lang.Runnable callback)Produces a newUniinvoking the given callback when theitemevent is fired.Uni<T>invoke(java.util.function.Consumer<? super T> callback)Produces a newUniinvoking the given callback when theitemevent is fired.Uni<T>invokeUni(java.util.function.Function<? super T,Uni<?>> action)Deprecated.Usecall(Function)<R> Uni<R>produceCompletionStage(java.util.function.Function<? super T,? extends java.util.concurrent.CompletionStage<? extends R>> mapper)Deprecated.UsetransformToUni(Function)and produce the Uni usingUni.createFrom().completionStage(...)<R> Multi<R>produceMulti(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper)Deprecated.UsetransformToMulti(Function)instead<R> Uni<R>produceUni(java.util.function.BiConsumer<? super T,UniEmitter<? super R>> consumer)Deprecated.UsetransformToUni(BiConsumer)instead.<R> Uni<R>produceUni(java.util.function.Function<? super T,Uni<? extends R>> mapper)Deprecated.UsetransformToUni(Function)instead<R> Uni<R>transform(java.util.function.Function<? super T,? extends R> mapper)<R> Multi<R>transformToMulti(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper)When thisUniproduces its item (notnull), call the givenmapperto produce aPublisher.<R> Uni<R>transformToUni(java.util.function.BiConsumer<? super T,UniEmitter<? super R>> consumer)Transforms the received item asynchronously, forwarding the events emitted anUniEmitterconsumes by the given consumer.<R> Uni<R>transformToUni(java.util.function.Function<? super T,Uni<? extends R>> mapper)Transforms the received item asynchronously, forwarding the events emitted by anotherUniproduced by the givenmapper.
-
-
-
Method Detail
-
invoke
public Uni<T> invoke(java.util.function.Consumer<? super T> callback)
Produces a newUniinvoking the given callback when theitemevent is fired. If the item isnull, the callback is not invoked.- Parameters:
callback- the callback, must not benull- Returns:
- the new
Uni
-
invoke
public Uni<T> invoke(java.lang.Runnable callback)
Produces a newUniinvoking the given callback when theitemevent is fired. If the item isnull, the callback is not invoked.- Parameters:
callback- the callback, must not benull- Returns:
- the new
Uni
-
invokeUni
@Deprecated public Uni<T> invokeUni(java.util.function.Function<? super T,Uni<?>> action)
Deprecated.Usecall(Function)Produces a newUniinvoking the given @{code action} when theitemevent is received. Note that if the received item isnull, the action is not executed, and the item is propagated downstream.Unlike
invoke(Consumer), the passed function returns aUni. When the producedUnisends its result, the result is discarded, and the original (non null)itemis forwarded downstream. If the producedUnifails, the failure is propagated downstream.- Parameters:
action- the callback, must not benull- Returns:
- the new
Uni
-
call
public Uni<T> call(java.util.function.Function<? super T,Uni<?>> action)
Produces a newUniinvoking the given @{code action} when theitemevent is received. Note that if the received item isnull, the action is not executed, and the item is propagated downstream.Unlike
invoke(Consumer), the passed function returns aUni. When the producedUnisends its result, the result is discarded, and the original (non null)itemis forwarded downstream. If the producedUnifails, the failure is propagated downstream.- Parameters:
action- the callback, must not benull- Returns:
- the new
Uni
-
call
public Uni<T> call(java.util.function.Supplier<Uni<?>> action)
Produces a newUniinvoking the given @{code action} when theitemevent is received. Note that if the received item isnull, the action is not executed.Unlike
invoke(Consumer), the passed function returns aUni. When the producedUnisends its result, the result is discarded, and the original (non null)itemis forwarded downstream. If the producedUnifails, the failure is propagated downstream.- Parameters:
action- the callback, must not benulland must not returnnull- Returns:
- the new
Uni
-
apply
@Deprecated public <R> Uni<R> apply(java.util.function.Function<? super T,? extends R> mapper)
Deprecated.Produces a newUniinvoking the given function when the currentUnifires theitemevent. The function receives the (non-null) item as parameter, and can transform it. The returned object is sent downstream asitem.If the item is `null`, the mapper is not called and it produces a
nullitem.For asynchronous composition, see
transformToUni(Function).- Type Parameters:
R- the type of Uni item- Parameters:
mapper- the mapper function, must not benull- Returns:
- the new
Uni
-
transform
public <R> Uni<R> transform(java.util.function.Function<? super T,? extends R> mapper)
Produces a newUniinvoking the given function when the currentUnifires theitemevent. The function receives the (non-null) item as parameter, and can transform it. The returned object is sent downstream asitem.If the item is `null`, the mapper is not called and it produces a
nullitem.For asynchronous composition, see
transformToUni(Function).- Type Parameters:
R- the type of Uni item- Parameters:
mapper- the mapper function, must not benull- Returns:
- the new
Uni
-
produceUni
@Deprecated public <R> Uni<R> produceUni(java.util.function.Function<? super T,Uni<? extends R>> mapper)
Deprecated.UsetransformToUni(Function)insteadTransforms the received item asynchronously, forwarding the events emitted by anotherUniproduced by the givenmapper.The mapper is called with the item event of the current
Uniand produces anUni, possibly using another type of item (R). The events fired by producedUniare forwarded to theUnireturned by this method.If the item is
null, the mapper is not called, andnullis propagated downstream.This operation is generally named
flatMap.
-
transformToUni
public <R> Uni<R> transformToUni(java.util.function.Function<? super T,Uni<? extends R>> mapper)
Transforms the received item asynchronously, forwarding the events emitted by anotherUniproduced by the givenmapper.The mapper is called with the item event of the current
Uniand produces anUni, possibly using another type of item (R). The events fired by producedUniare forwarded to theUnireturned by this method.If the item is
null, the mapper is not called, andnullis propagated downstream.This operation is generally named
flatMap.
-
transformToMulti
public <R> Multi<R> transformToMulti(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper)
When thisUniproduces its item (notnull), call the givenmapperto produce aPublisher. Continue the pipeline with this publisher (as aMulti).The mapper is called with the item event of the current
Uniand produces aPublisher, possibly using another type of item (R). Events fired by the producedPublisherare forwarded to theMultireturned by this method.If the item is `null`, the mapper is not called and an empty
Multiis produced.This operation is generally named
flatMapPublisher.- Type Parameters:
R- the type of item produced by the resultingMulti- Parameters:
mapper- the mapper, must not benull, may expect to receivenullas item.- Returns:
- the multi
-
produceMulti
@Deprecated public <R> Multi<R> produceMulti(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper)
Deprecated.UsetransformToMulti(Function)insteadWhen thisUniproduces its item (notnull), call the givenmapperto produce aPublisher. Continue the pipeline with this publisher (as aMulti).The mapper is called with the item event of the current
Uniand produces aPublisher, possibly using another type of item (R). Events fired by the producedPublisherare forwarded to theMultireturned by this method.If the item is `null`, the mapper is not called and an empty
Multiis produced.This operation is generally named
flatMapPublisher.- Type Parameters:
R- the type of item produced by the resultingMulti- Parameters:
mapper- the mapper, must not benull, may expect to receivenullas item.- Returns:
- the multi
-
produceCompletionStage
@Deprecated public <R> Uni<R> produceCompletionStage(java.util.function.Function<? super T,? extends java.util.concurrent.CompletionStage<? extends R>> mapper)
Deprecated.UsetransformToUni(Function)and produce the Uni usingUni.createFrom().completionStage(...)Transforms the received item asynchronously, forwarding the events emitted by anotherCompletionStageproduced by the givenmapper.The mapper is called with the item event of the current
Uniand produces anCompletionStage, possibly using another type of item (R). The events fired by producedCompletionStageare forwarded to theUnireturned by this method.If the incoming item is
null, the mapper is not called, and aCompletionStageredeemingnullis returned.- Type Parameters:
R- the type of item- Parameters:
mapper- the function called with the item of thisUniand producing theCompletionStage, must not benull, must not returnnull.- Returns:
- a new
Unithat would fire events from the uni produced by the mapper function, possibly in an asynchronous manner.
-
transformToUni
public <R> Uni<R> transformToUni(java.util.function.BiConsumer<? super T,UniEmitter<? super R>> consumer)
Transforms the received item asynchronously, forwarding the events emitted anUniEmitterconsumes by the given consumer.The consumer is called with the item event of the current
Uniand an emitter uses to fire events. These events are these propagated by the producedUni.If the incoming item is
null, theconsumeris not called and anullitem is propagated downstream.- Type Parameters:
R- the type of item emitted by the emitter- Parameters:
consumer- the function called with the item of the thisUniand anUniEmitter. It must not benull.- Returns:
- a new
Unithat would fire events from the emitter consumed by the mapper function, possibly in an asynchronous manner.
-
produceUni
@Deprecated public <R> Uni<R> produceUni(java.util.function.BiConsumer<? super T,UniEmitter<? super R>> consumer)
Deprecated.UsetransformToUni(BiConsumer)instead.Transforms the received item asynchronously, forwarding the events emitted anUniEmitterconsumes by the given consumer.The consumer is called with the item event of the current
Uniand an emitter uses to fire events. These events are these propagated by the producedUni.If the incoming item is
null, theconsumeris not called and anullitem is propagated downstream.- Type Parameters:
R- the type of item emitted by the emitter- Parameters:
consumer- the function called with the item of the thisUniand anUniEmitter. It must not benull.- Returns:
- a new
Unithat would fire events from the emitter consumed by the mapper function, possibly in an asynchronous manner.
-
-