Package com.forgerock.reactive
Interface Single<V>
-
- Type Parameters:
V- Type of the datum emitted
- All Superinterfaces:
org.reactivestreams.Publisher<V>
public interface Single<V> extends org.reactivestreams.Publisher<V>Single is a reactive-streams compatible promise. It extendsPublisherby providing additional reactive methods allowing to act on it. The goal of this interface is to decouple ourself from reactive framework (RxJava/Reactor).
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceSingle.Emitter<V>Adapts the streaming api to a callback one.static interfaceSingle.Subscriber<V>Subscriber is notified when the operation has been completed, successfully or not.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <O> Single<O>flatMap(org.forgerock.util.Function<V,Single<O>,Exception> function)Transforms asynchronously the value emitted by this single into another.<O> Single<O>map(org.forgerock.util.Function<V,O,Exception> function)Transforms the value emitted by this single.Single<V>onErrorResumeWith(org.forgerock.util.Function<Throwable,Single<V>,Exception> function)When an error occurs in this stream, continue the processing with the newSingleprovided by the function.voidsubscribe(Consumer<? super V> resultConsumer, Consumer<Throwable> errorConsumer)Subscribe to the single value emitted by thisSingle.Stream<V>toStream()
-
-
-
Method Detail
-
map
<O> Single<O> map(org.forgerock.util.Function<V,O,Exception> function)
Transforms the value emitted by this single.- Type Parameters:
O- Type of the datum emitted after transformation- Parameters:
function- Function to apply to the result of this single.- Returns:
- A new
Singlewith the transformed value.
-
flatMap
<O> Single<O> flatMap(org.forgerock.util.Function<V,Single<O>,Exception> function)
Transforms asynchronously the value emitted by this single into another.
-
onErrorResumeWith
Single<V> onErrorResumeWith(org.forgerock.util.Function<Throwable,Single<V>,Exception> function)
When an error occurs in this stream, continue the processing with the newSingleprovided by the function.
-
-