- java.lang.Object
-
- life.expert.common.reactivestreams.Patterns
-
public final class Patterns extends java.lang.Objectauxiliary static functions with arguments - several Mono 1) Gently convert Vavr's Try to Reactor's Flux monoFromNullableTry monoFromTry fluxFromNullableTry fluxFromTry 2) Range of Integers from start to end, even in reverse order. range( final int start , final int end ) longRange( final long start , final long end ) 3) Indexed (with Integer or Long) elements of Flux. Wrap element with index into Tuple2 indexed longIndexed
-
-
Constructor Summary
Constructors Constructor Description Patterns()
-
Method Summary
Modifier and Type Method Description static <T> reactor.core.publisher.Flux<T>fluxFromNullableTry(io.vavr.control.Try<T> tryObject)Flux from try.static <T> reactor.core.publisher.Flux<T>fluxFromTry(io.vavr.control.Try<T> tryObject)Flux from try.static <T,R>
java.util.function.Function<T,reactor.core.publisher.Mono<R>>functionToMonoParallel(io.vavr.CheckedFunction1<T,R> function, reactor.core.scheduler.Scheduler scheduler)Alias forCheckedConsumer.unchecked()static <T,R>
java.util.function.Function<T,reactor.core.publisher.Mono<R>>functionToMonoParallelLogError(io.vavr.CheckedFunction1<T,R> function, reactor.core.scheduler.Scheduler scheduler, java.lang.String message)Function to mono parallel log error function.static <E> reactor.core.publisher.Flux<io.vavr.Tuple2<java.lang.Integer,E>>indexed(reactor.core.publisher.Flux<E> flux)Indexed (with Integer) elements of Flux.static <E> reactor.core.publisher.Flux<io.vavr.Tuple2<java.lang.Long,E>>longIndexed(reactor.core.publisher.Flux<E> flux)Indexed (with Long) elements of Flux.static reactor.core.publisher.Flux<java.lang.Long>longRange(long start, long end)Range of Longs from start to end, even in reverse order.static <T> reactor.core.publisher.Mono<T>monoFromNullableTry(io.vavr.control.Try<T> tryObject)Mono from try.static <T> reactor.core.publisher.Mono<T>monoFromTry(io.vavr.control.Try<T> tryObject)Mono from try.static reactor.core.publisher.Flux<java.lang.Integer>range(int start, int end)Range of Integers from start to end, even in reverse order.static <T> io.vavr.control.Try<T>tryFromFlux(reactor.core.publisher.Flux<T> flux)Try from Flux.static <T> io.vavr.control.Try<T>tryFromMono(reactor.core.publisher.Mono<T> mono)Try from Mono.
-
-
-
Method Detail
-
monoFromNullableTry
public static <T> reactor.core.publisher.Mono<T> monoFromNullableTry(io.vavr.control.Try<T> tryObject)
Mono from try. Try with null inside transforms to empty event- Type Parameters:
T- the type parameter- Parameters:
tryObject- the try object- Returns:
- the mono
-
monoFromTry
public static <T> reactor.core.publisher.Mono<T> monoFromTry(io.vavr.control.Try<T> tryObject)
Mono from try. Try with null inside transforms to error event- Type Parameters:
T- the type parameter- Parameters:
tryObject- the try object- Returns:
- the mono
-
fluxFromNullableTry
public static <T> reactor.core.publisher.Flux<T> fluxFromNullableTry(io.vavr.control.Try<T> tryObject)
Flux from try. Try with null inside transforms to empty event- Type Parameters:
T- the type parameter- Parameters:
tryObject- the try object- Returns:
- the flux
-
fluxFromTry
public static <T> reactor.core.publisher.Flux<T> fluxFromTry(io.vavr.control.Try<T> tryObject)
Flux from try. Try with null inside transforms to error event- Type Parameters:
T- the type parameter- Parameters:
tryObject- the try object- Returns:
- the flux
-
tryFromMono
public static <T> io.vavr.control.Try<T> tryFromMono(reactor.core.publisher.Mono<T> mono)
Try from Mono. Mono with error event transforms Failure- Type Parameters:
T- the type parameter- Parameters:
mono- the mono object- Returns:
- the Try
-
tryFromFlux
public static <T> io.vavr.control.Try<T> tryFromFlux(reactor.core.publisher.Flux<T> flux)
Try from Flux. Mono with error event transforms Failure- Type Parameters:
T- the type parameter- Parameters:
flux- the flux object- Returns:
- the Try
-
functionToMonoParallel
public static <T,R> java.util.function.Function<T,reactor.core.publisher.Mono<R>> functionToMonoParallel(io.vavr.CheckedFunction1<T,R> function, reactor.core.scheduler.Scheduler scheduler)Alias forCheckedConsumer.unchecked()- Type Parameters:
T- return typeR- the type parameter- Parameters:
function- the functionscheduler- the scheduler- Returns:
- An unchecked wrapper of supplied uncheckedFunction
-
functionToMonoParallelLogError
public static <T,R> java.util.function.Function<T,reactor.core.publisher.Mono<R>> functionToMonoParallelLogError(io.vavr.CheckedFunction1<T,R> function, reactor.core.scheduler.Scheduler scheduler, java.lang.String message)Function to mono parallel log error function.- Type Parameters:
T- the type parameterR- the type parameter- Parameters:
function- the functionscheduler- the schedulermessage- the message- Returns:
- the function
-
range
public static reactor.core.publisher.Flux<java.lang.Integer> range(int start, int end)Range of Integers from start to end, even in reverse order. Borders inclusive.- Parameters:
start- the startend- the end- Returns:
- the flux
-
longRange
public static reactor.core.publisher.Flux<java.lang.Long> longRange(long start, long end)Range of Longs from start to end, even in reverse order. Borders inclusive.- Parameters:
start- the startend- the end- Returns:
- the flux
-
indexed
public static <E> reactor.core.publisher.Flux<io.vavr.Tuple2<java.lang.Integer,E>> indexed(reactor.core.publisher.Flux<E> flux)
Indexed (with Integer) elements of Flux. Wrap element with index into Tuple2- Type Parameters:
E- the type parameter- Parameters:
flux- the flux- Returns:
- the flux
-
longIndexed
public static <E> reactor.core.publisher.Flux<io.vavr.Tuple2<java.lang.Long,E>> longIndexed(reactor.core.publisher.Flux<E> flux)
Indexed (with Long) elements of Flux. Wrap element with index into Tuple2- Type Parameters:
E- the type parameter- Parameters:
flux- the flux- Returns:
- the flux
-
-