public class Monos
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Monos.Instances
Companion class for creating Type Class instances for working with Monos
|
static interface |
Monos.MonoNested |
static interface |
Monos.NestedMono |
| Constructor and Description |
|---|
Monos() |
| Modifier and Type | Method and Description |
|---|---|
static <T> reactor.core.publisher.Mono<T> |
allOf(reactor.core.publisher.Mono<T>... fts)
Wait until all the provided Future's to complete
|
static <T> Active<ReactorWitness.mono,T> |
allTypeclasses(reactor.core.publisher.Mono<T> type) |
static <T> AnyMValue<ReactorWitness.mono,T> |
anyM(reactor.core.publisher.Mono<T> mono)
Construct an AnyM type from a Mono.
|
static <T> reactor.core.publisher.Mono<T> |
anyOf(reactor.core.publisher.Mono<T>... fts)
Select the first Mono to complete
|
static <T1,T2,R> reactor.core.publisher.Mono<R> |
combine(reactor.core.publisher.Mono<? extends T1> mono,
reactor.core.publisher.Mono<? extends T2> app,
java.util.function.BiFunction<? super T1,? super T2,? extends R> fn)
Lazily combine this Mono with the supplied Mono via the supplied BiFunction
|
static <T1,T2,R> reactor.core.publisher.Mono<R> |
combine(reactor.core.publisher.Mono<? extends T1> mono,
Value<? extends T2> app,
java.util.function.BiFunction<? super T1,? super T2,? extends R> fn)
Lazily combine this Mono with the supplied value via the supplied BiFunction
|
static <W1,T> Coproduct<W1,ReactorWitness.mono,T> |
coproduct(reactor.core.publisher.Mono<T> list,
InstanceDefinitions<W1> def1) |
static <W1,T> Coproduct<W1,ReactorWitness.mono,T> |
coproduct(T value,
InstanceDefinitions<W1> def1) |
static <R> Either<java.lang.Throwable,R> |
either(reactor.core.publisher.Mono<R> either) |
static <T> Eval<T> |
eval(reactor.core.publisher.Mono<T> opt) |
static <T> reactor.core.publisher.Mono<T> |
firstSuccess(reactor.core.publisher.Mono<T>... fts)
Select the first Future to return with a successful result
|
static <T,R1,R> reactor.core.publisher.Mono<R> |
forEach(reactor.core.publisher.Mono<? extends T> value1,
java.util.function.Function<? super T,reactor.core.publisher.Mono<R1>> value2,
java.util.function.BiFunction<? super T,? super R1,? extends R> yieldingFunction)
Perform a For Comprehension over a Mono, accepting a generating function.
|
static <T1,T2,R1,R2,R> |
forEach3(reactor.core.publisher.Mono<? extends T1> value1,
java.util.function.Function<? super T1,? extends reactor.core.publisher.Mono<R1>> value2,
java.util.function.BiFunction<? super T1,? super R1,? extends reactor.core.publisher.Mono<R2>> value3,
Fn3<? super T1,? super R1,? super R2,? extends R> yieldingFunction)
Perform a For Comprehension over a Mono, accepting 2 generating functions.
|
static <T1,T2,T3,R1,R2,R3,R> |
forEach4(reactor.core.publisher.Mono<? extends T1> value1,
java.util.function.Function<? super T1,? extends reactor.core.publisher.Mono<R1>> value2,
java.util.function.BiFunction<? super T1,? super R1,? extends reactor.core.publisher.Mono<R2>> value3,
Fn3<? super T1,? super R1,? super R2,? extends reactor.core.publisher.Mono<R3>> value4,
Fn4<? super T1,? super R1,? super R2,? super R3,? extends R> yieldingFunction)
Perform a For Comprehension over a Mono, accepting 3 generating functions.
|
static <T> reactor.core.publisher.Mono<T> |
fromIterable(java.lang.Iterable<T> t)
Construct a Mono from Iterable by taking the first value from Iterable
|
static <T> Future<T> |
future(reactor.core.publisher.Mono<T> future) |
static <T> Future[] |
futures(reactor.core.publisher.Mono<T>... futures) |
static <T> java.util.Iterator<T> |
iterator(reactor.core.publisher.Mono<T> pub)
Get an Iterator for the value (if any) in the provided Mono
|
static <W extends WitnessType<W>,T> |
liftM(AnyM<W,reactor.core.publisher.Mono<T>> nested) |
static <T,W extends WitnessType<W>> |
liftM(reactor.core.publisher.Mono<T> opt,
W witness) |
static <T,W2,R> Nested<ReactorWitness.mono,W2,R> |
mapM(reactor.core.publisher.Mono<T> type,
java.util.function.Function<? super T,? extends Higher<W2,R>> fn,
InstanceDefinitions<W2> defs) |
static <T> Maybe<T> |
maybe(reactor.core.publisher.Mono<T> opt) |
static <R> reactor.core.publisher.Mono<R> |
narrow(reactor.core.publisher.Mono<? extends R> apply) |
static <T> reactor.core.publisher.Mono<ListX<T>> |
quorum(java.util.function.Predicate<Status<T>> breakout,
java.util.function.Consumer<java.lang.Throwable> errorHandler,
reactor.core.publisher.Mono<T>... fts)
Block until a Quorum of results have returned as determined by the provided Predicate
|
static <T> reactor.core.publisher.Mono<ListX<T>> |
quorum(java.util.function.Predicate<Status<T>> breakout,
reactor.core.publisher.Mono<T>... fts)
Block until a Quorum of results have returned as determined by the provided Predicate
|
static <T> reactor.core.publisher.Mono<T> |
raw(AnyM<ReactorWitness.mono,T> anyM) |
static <T,R> reactor.core.publisher.Mono<R> |
tailRec(T initial,
java.util.function.Function<? super T,? extends reactor.core.publisher.Mono<? extends Xor<T,R>>> fn) |
static <T> boolean |
test(reactor.core.publisher.Mono<T> mono,
T test)
Test if value is equal to the value inside this Mono
|
static <W1 extends WitnessType<W1>,T> |
xorM(reactor.core.publisher.Mono<T> type) |
static <T1,T2,R> reactor.core.publisher.Mono<R> |
zip(reactor.core.publisher.Mono<? extends T1> mono,
java.util.function.BiFunction<? super T1,? super T2,? extends R> fn,
org.reactivestreams.Publisher<? extends T2> app)
Combine the provided Mono with the first element (if present) in the provided Publisher using the provided BiFunction
|
static <T1,T2,R> reactor.core.publisher.Mono<R> |
zip(reactor.core.publisher.Mono<? extends T1> mono,
java.lang.Iterable<? extends T2> app,
java.util.function.BiFunction<? super T1,? super T2,? extends R> fn)
Combine the provided Mono with the first element (if present) in the provided Iterable using the provided BiFunction
|
public static <W1,T> Coproduct<W1,ReactorWitness.mono,T> coproduct(reactor.core.publisher.Mono<T> list, InstanceDefinitions<W1> def1)
public static <W1,T> Coproduct<W1,ReactorWitness.mono,T> coproduct(T value, InstanceDefinitions<W1> def1)
public static <W1 extends WitnessType<W1>,T> XorM<W1,ReactorWitness.mono,T> xorM(reactor.core.publisher.Mono<T> type)
public static <T> reactor.core.publisher.Mono<T> raw(AnyM<ReactorWitness.mono,T> anyM)
public static <T,R> reactor.core.publisher.Mono<R> tailRec(T initial,
java.util.function.Function<? super T,? extends reactor.core.publisher.Mono<? extends Xor<T,R>>> fn)
public static <W extends WitnessType<W>,T> MonoT<W,T> liftM(AnyM<W,reactor.core.publisher.Mono<T>> nested)
public static <T,W extends WitnessType<W>> MonoT<W,T> liftM(reactor.core.publisher.Mono<T> opt, W witness)
public static <T> Future[] futures(reactor.core.publisher.Mono<T>... futures)
public static <T> Future<T> future(reactor.core.publisher.Mono<T> future)
public static <R> Either<java.lang.Throwable,R> either(reactor.core.publisher.Mono<R> either)
public static <T> Maybe<T> maybe(reactor.core.publisher.Mono<T> opt)
public static <T> Eval<T> eval(reactor.core.publisher.Mono<T> opt)
public static <T> AnyMValue<ReactorWitness.mono,T> anyM(reactor.core.publisher.Mono<T> mono)
AnyMSeq<Integer> mono = Fluxs.anyM(Mono.just(1,2,3));
AnyMSeq<Integer> transformedMono = myGenericOperation(mono);
public AnyMSeq<Integer> myGenericOperation(AnyMSeq<Integer> monad);
mono - To wrap inside an AnyMpublic static <T> reactor.core.publisher.Mono<T> anyOf(reactor.core.publisher.Mono<T>... fts)
fts - Monos to raceCompletableFuture.anyOf(CompletableFuture...)public static <T> reactor.core.publisher.Mono<T> allOf(reactor.core.publisher.Mono<T>... fts)
fts - Monos to wait onCompletableFuture.allOf(CompletableFuture...)@SafeVarargs public static <T> reactor.core.publisher.Mono<ListX<T>> quorum(java.util.function.Predicate<Status<T>> breakout, java.util.function.Consumer<java.lang.Throwable> errorHandler, reactor.core.publisher.Mono<T>... fts)
Mono<ListX<Integer>> strings = Monos.quorum(status -> status.getCompleted() >0, Mono.deferred(()->1),Mono.empty(),Mono.empty());
strings.get().size()
//1
breakout - Predicate that determines whether the block should be
continued or removedfts - FutureWs to wait on results fromerrorHandler - Consumer to handle any exceptions thrown@SafeVarargs public static <T> reactor.core.publisher.Mono<ListX<T>> quorum(java.util.function.Predicate<Status<T>> breakout, reactor.core.publisher.Mono<T>... fts)
Mono<ListX<Integer>> strings = Monos.quorum(status -> status.getCompleted() >0, Mono.deferred(()->1),Mono.empty(),Mono.empty());
strings.get().size()
//1
breakout - Predicate that determines whether the block should be
continued or removedfts - Monos to wait on results from@SafeVarargs public static <T> reactor.core.publisher.Mono<T> firstSuccess(reactor.core.publisher.Mono<T>... fts)
Mono<Integer> ft = Mono.empty();
Mono<Integer> result = Monos.firstSuccess(Mono.deferred(()->1),ft);
ft.complete(10);
result.get() //1
fts - Monos to racepublic static <T1,T2,T3,R1,R2,R3,R> reactor.core.publisher.Mono<R> forEach4(reactor.core.publisher.Mono<? extends T1> value1,
java.util.function.Function<? super T1,? extends reactor.core.publisher.Mono<R1>> value2,
java.util.function.BiFunction<? super T1,? super R1,? extends reactor.core.publisher.Mono<R2>> value3,
Fn3<? super T1,? super R1,? super R2,? extends reactor.core.publisher.Mono<R3>> value4,
Fn4<? super T1,? super R1,? super R2,? super R3,? extends R> yieldingFunction)
import static cyclops.companion.reactor.Monos.forEach4;
forEach4(Mono.just(1),
a-> Mono.just(a+1),
(a,b) -> Mono.<Integer>just(a+b),
(a,b,c) -> Mono.<Integer>just(a+b+c),
Tuple::tuple)
value1 - top level Monovalue2 - Nested Monovalue3 - Nested Monovalue4 - Nested MonoyieldingFunction - Generates a result per combinationpublic static <T1,T2,R1,R2,R> reactor.core.publisher.Mono<R> forEach3(reactor.core.publisher.Mono<? extends T1> value1,
java.util.function.Function<? super T1,? extends reactor.core.publisher.Mono<R1>> value2,
java.util.function.BiFunction<? super T1,? super R1,? extends reactor.core.publisher.Mono<R2>> value3,
Fn3<? super T1,? super R1,? super R2,? extends R> yieldingFunction)
import static cyclops.companion.reactor.Monos.forEach3;
forEach3(Mono.just(1),
a-> Mono.just(a+1),
(a,b) -> Mono.<Integer>just(a+b),
Tuple::tuple)
value1 - top level Monovalue2 - Nested Monovalue3 - Nested MonoyieldingFunction - Generates a result per combinationpublic static <T,R1,R> reactor.core.publisher.Mono<R> forEach(reactor.core.publisher.Mono<? extends T> value1,
java.util.function.Function<? super T,reactor.core.publisher.Mono<R1>> value2,
java.util.function.BiFunction<? super T,? super R1,? extends R> yieldingFunction)
import static cyclops.companion.reactor.Monos.forEach;
forEach(Mono.just(1),
a-> Mono.just(a+1),
Tuple::tuple)
value1 - top level Monovalue2 - Nested MonoyieldingFunction - Generates a result per combinationpublic static <T1,T2,R> reactor.core.publisher.Mono<R> combine(reactor.core.publisher.Mono<? extends T1> mono,
Value<? extends T2> app,
java.util.function.BiFunction<? super T1,? super T2,? extends R> fn)
mono - Mono to combine with another valueapp - Value to combine with supplied monofn - Combiner functionpublic static <T1,T2,R> reactor.core.publisher.Mono<R> combine(reactor.core.publisher.Mono<? extends T1> mono,
reactor.core.publisher.Mono<? extends T2> app,
java.util.function.BiFunction<? super T1,? super T2,? extends R> fn)
mono - Mono to combine with another valueapp - Mono to combine with supplied monofn - Combiner functionpublic static <T1,T2,R> reactor.core.publisher.Mono<R> zip(reactor.core.publisher.Mono<? extends T1> mono,
java.lang.Iterable<? extends T2> app,
java.util.function.BiFunction<? super T1,? super T2,? extends R> fn)
mono - Mono to combine with an Iterableapp - Iterable to combine with a Monofn - Combining functionpublic static <T1,T2,R> reactor.core.publisher.Mono<R> zip(reactor.core.publisher.Mono<? extends T1> mono,
java.util.function.BiFunction<? super T1,? super T2,? extends R> fn,
org.reactivestreams.Publisher<? extends T2> app)
mono - Mono to combine with a Publisherfn - Publisher to combine with a Monoapp - Combining functionpublic static <T> boolean test(reactor.core.publisher.Mono<T> mono,
T test)
mono - Mono to testtest - Value to testpublic static <T> reactor.core.publisher.Mono<T> fromIterable(java.lang.Iterable<T> t)
t - Iterable to populate Mono frompublic static <T> java.util.Iterator<T> iterator(reactor.core.publisher.Mono<T> pub)
pub - Mono to get Iterator forpublic static <R> reactor.core.publisher.Mono<R> narrow(reactor.core.publisher.Mono<? extends R> apply)
public static <T> Active<ReactorWitness.mono,T> allTypeclasses(reactor.core.publisher.Mono<T> type)
public static <T,W2,R> Nested<ReactorWitness.mono,W2,R> mapM(reactor.core.publisher.Mono<T> type, java.util.function.Function<? super T,? extends Higher<W2,R>> fn, InstanceDefinitions<W2> defs)