Class UniOnItemOrFailure<T>
- java.lang.Object
-
- io.smallrye.mutiny.groups.UniOnItemOrFailure<T>
-
public class UniOnItemOrFailure<T> extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description UniOnItemOrFailure(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.BiFunction<? super T,java.lang.Throwable,? extends R> mapper)Deprecated.Uni<T>call(java.util.function.BiFunction<? super T,java.lang.Throwable,Uni<?>> callback)Uni<T>call(java.util.function.Supplier<Uni<?>> callback)Uni<T>invoke(java.lang.Runnable callback)Uni<T>invoke(java.util.function.BiConsumer<? super T,java.lang.Throwable> callback)Uni<T>invokeUni(java.util.function.BiFunction<? super T,java.lang.Throwable,Uni<?>> callback)Deprecated.Usecall(BiFunction)<R> Uni<R>produceUni(Functions.TriConsumer<? super T,java.lang.Throwable,UniEmitter<? super R>> consumer)Deprecated.UsetransformToUni(Functions.TriConsumer)instead<R> Uni<R>produceUni(java.util.function.BiFunction<? super T,java.lang.Throwable,Uni<? extends R>> mapper)Deprecated.UsetransformToUni(BiFunction)instead<R> Uni<R>transform(java.util.function.BiFunction<? super T,java.lang.Throwable,? extends R> mapper)<R> Uni<R>transformToUni(Functions.TriConsumer<? super T,java.lang.Throwable,UniEmitter<? super R>> consumer)Transforms the received item or failure asynchronously, forwarding the events emitted by theUniEmitterprovided to the given consumer.<R> Uni<R>transformToUni(java.util.function.BiFunction<? super T,java.lang.Throwable,Uni<? extends R>> mapper)Transforms the received item or failure asynchronously, forwarding the events emitted by anotherUniproduced by the givenmapper.
-
-
-
Method Detail
-
invoke
public Uni<T> invoke(java.util.function.BiConsumer<? super T,java.lang.Throwable> callback)
Produces a newUniinvoking the given callback when theitemorfailureevent is fired. Note that the item can benull, so detecting failures must be done by checking whether thefailureparameter isnull.- 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 theitemorfailureevent is fired. The failure or item is being ignore by the callback.- Parameters:
callback- the callback, must not benull- Returns:
- the new
Uni
-
call
public Uni<T> call(java.util.function.BiFunction<? super T,java.lang.Throwable,Uni<?>> callback)
Produces a newUniinvoking the given callback when theitemorfailureevent is fired. Note that the item can benull, so detecting failures must be done by checking whether thefailureparameter isnull.- Parameters:
callback- the callback, must not benull- Returns:
- the new
Uni
-
call
public Uni<T> call(java.util.function.Supplier<Uni<?>> callback)
Produces a newUniinvoking the given callback when theitemorfailureevent is fired. The failure or item is being ignore by the callback.- Parameters:
callback- the callback, must not benull- Returns:
- the new
Uni
-
invokeUni
@Deprecated public Uni<T> invokeUni(java.util.function.BiFunction<? super T,java.lang.Throwable,Uni<?>> callback)
Deprecated.Usecall(BiFunction)Produces a newUniinvoking the given callback when theitemorfailureevent is fired. Note that the item can benull, so detecting failures must be done by checking whether thefailureparameter isnull.- Parameters:
callback- the callback, must not benull- Returns:
- the new
Uni
-
apply
@Deprecated public <R> Uni<R> apply(java.util.function.BiFunction<? super T,java.lang.Throwable,? extends R> mapper)
Deprecated.Produces a newUniinvoking the given function when the currentUnifires theitemorfailureevent. Note that the item can benull, so detecting failures must be done by checking whether thefailureparameter isnull.The function receives the item and failure as parameters, and can transform the item or recover from the failure. The returned object is sent downstream as
item.For asynchronous composition, see
transformToUni(BiFunction).- 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.BiFunction<? super T,java.lang.Throwable,? extends R> mapper)
Produces a newUniinvoking the given function when the currentUnifires theitemorfailureevent. Note that the item can benull, so detecting failures must be done by checking whether thefailureparameter isnull.The function receives the item and failure as parameters, and can transform the item or recover from the failure. The returned object is sent downstream as
item.For asynchronous composition, see
transformToUni(BiFunction).- Type Parameters:
R- the type of Uni item- Parameters:
mapper- the mapper function, must not benull- Returns:
- the new
Uni
-
transformToUni
public <R> Uni<R> transformToUni(java.util.function.BiFunction<? super T,java.lang.Throwable,Uni<? extends R>> mapper)
Transforms the received item or failure asynchronously, forwarding the events emitted by anotherUniproduced by the givenmapper.Note that the item can be
null, so detecting failures must be done by checking whether thefailureparameter isnull.The mapper is called with the item produced by the upstream or the propagated failure. It produces an
Uni, possibly using another type of item (R). It can be used to recover from a failure. The events fired by the producedUniare forwarded to theUnireturned by this method.This operation is generally named
flatMap.- Type Parameters:
R- the type of item- Parameters:
mapper- the function called with the item and failure sent by the upstreamUnito produce anotherUni, 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.
-
produceUni
@Deprecated public <R> Uni<R> produceUni(java.util.function.BiFunction<? super T,java.lang.Throwable,Uni<? extends R>> mapper)
Deprecated.UsetransformToUni(BiFunction)insteadTransforms the received item or failure asynchronously, forwarding the events emitted by anotherUniproduced by the givenmapper.Note that the item can be
null, so detecting failures must be done by checking whether thefailureparameter isnull.The mapper is called with the item produced by the upstream or the propagated failure. It produces an
Uni, possibly using another type of item (R). It can be used to recover from a failure. The events fired by the producedUniare forwarded to theUnireturned by this method.This operation is generally named
flatMap.- Type Parameters:
R- the type of item- Parameters:
mapper- the function called with the item and failure sent by the upstreamUnito produce anotherUni, 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(Functions.TriConsumer<? super T,java.lang.Throwable,UniEmitter<? super R>> consumer)
Transforms the received item or failure asynchronously, forwarding the events emitted by theUniEmitterprovided to the given consumer.The consumer is called with the item event or failure event emitted by the current
Uniand an emitter used to fire events downstream.As the item received from upstream can be
null, detecting a failure must be done by checking whether the failure passed to the consumer isnull.- 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(Functions.TriConsumer<? super T,java.lang.Throwable,UniEmitter<? super R>> consumer)
Deprecated.UsetransformToUni(Functions.TriConsumer)insteadTransforms the received item or failure asynchronously, forwarding the events emitted by theUniEmitterprovided to the given consumer.The consumer is called with the item event or failure event emitted by the current
Uniand an emitter used to fire events downstream.As the item received from upstream can be
null, detecting a failure must be done by checking whether the failure passed to the consumer isnull.- 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.
-
-