public static class FluentFunctions.FluentFunction<T,R> extends java.lang.Object implements Fn1<T,R>, Reader<T,R>
Fn1.µ, Fn1.FunctionalOperations<T1,R>
Constructor and Description |
---|
FluentFunction(java.util.function.Function<T,R> fn) |
Modifier and Type | Method and Description |
---|---|
FluentFunctions.FluentFunction<T,R> |
after(java.util.function.BiConsumer<T,R> action)
Apply After advice toNested this function capturing both the input and the emitted with the provided BiConsumer
|
<V> FluentFunctions.FluentFunction<T,V> |
andThen(java.util.function.Function<? super R,? extends V> after) |
R |
apply(T t)
Apply this function to the arguments.
|
FluentFunctions.FluentFunction<T,R> |
around(java.util.function.Function<FluentFunctions.Advice1<T,R>,R> around)
Apply around advice toNested this function, captures input allows emitted toNested be controlled by the advice
|
java.util.concurrent.CompletableFuture<FluentFunctions.FluentFunction<T,R>> |
async(java.util.concurrent.Executor ex)
Move this function into an asynchronous context
|
FluentFunctions.FluentFunction<T,R> |
before(java.util.function.Consumer<T> action)
Apply before advice toNested this function, capture the input with the provided Consumer
|
<V> FluentFunctions.FluentFunction<V,R> |
compose(java.util.function.Function<? super V,? extends T> before) |
<R1> FluentFunctions.FluentFunction<T,R1> |
flatMap(java.util.function.Function<? super R,? extends Reader<T,R1>> f)
FlatMap this Reader by applying the prodived function and unnesting to a single Reader
|
ReactiveSeq<R> |
generate(T input) |
ReactiveSeq<R> |
iterate(T seed,
java.util.function.Function<R,T> mapToType)
Generate an infinite Stream that iterates from the specified seed using the currently wrapped function
e.g.
|
FluentFunctions.FluentFunction<T,java.util.concurrent.CompletableFuture<R>> |
liftAsync(java.util.concurrent.Executor ex) |
<X extends java.lang.Throwable> |
liftTry(java.lang.Class<X>... classes) |
FluentFunctions.FluentFunction<T,R> |
log(java.util.function.Consumer<java.lang.String> logger,
java.util.function.Consumer<java.lang.Throwable> error)
A Function that logs it's success or error states toNested the provided Consumers
|
<R1> FluentFunctions.FluentFunction<T,R1> |
map(java.util.function.Function<? super R,? extends R1> f2)
Transform this functor using the supplied transformation function
|
FluentFunctions.FluentFunction<T,R> |
memoize() |
FluentFunctions.FluentFunction<T,R> |
memoize(Cacheable<R> cache) |
FluentFunctions.FluentFunction<T,R> |
name(java.lang.String name) |
FluentFunctions.FluentSupplier<R> |
partiallyApply(T param)
Partially apply the provided value toNested this function, toNested turn it into a Supplier
|
FluentFunctions.FluentFunction<T,R> |
println() |
<X extends java.lang.Throwable> |
recover(java.lang.Class<X> type,
java.util.function.Function<T,R> onError)
A Function that can recover from the specified exception types, using the provided recovery Function
|
FluentFunctions.FluentFunction<T,R> |
retry(int times,
int backoffStartTime)
A Function capable of retrying on failure using an exponential backoff strategy
|
FluentFunctions.FluentFunction<T,R> |
visitEvent(java.util.function.Consumer<R> eventConsumer,
java.util.function.Consumer<java.lang.Throwable> errorConsumer)
Visit the result of this Function once it has been executed, if the Function executes successfully the
result will be passes toNested the eventConsumer, if there is an error it will be passed toNested the errorConsumer
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
andThen, bind, fanIn, firstFn, functionOps, leftFn, lift, lift, liftF, liftOpt, liftTry, memoizeAsync, memoizeAsync, merge, narrow, product, product, product, reader, rightFn, secondFn, λ, λv
apply, applyPartially, applyPartially, curry, curry, from, toFunction
cast, peek, retry, retry, trampoline
public R apply(T t)
org.jooq.lambda.function.Function1
public <R1> FluentFunctions.FluentFunction<T,R1> map(java.util.function.Function<? super R,? extends R1> f2)
Transformable
of(1,2,3).map(i->i*2)
//[2,4,6]
public <R1> FluentFunctions.FluentFunction<T,R1> flatMap(java.util.function.Function<? super R,? extends Reader<T,R1>> f)
Reader
public FluentFunctions.FluentFunction<T,R> before(java.util.function.Consumer<T> action)
action
- Before advicepublic FluentFunctions.FluentFunction<T,R> after(java.util.function.BiConsumer<T,R> action)
action
- After advicepublic FluentFunctions.FluentFunction<T,R> around(java.util.function.Function<FluentFunctions.Advice1<T,R>,R> around)
around
- Around advicepublic FluentFunctions.FluentSupplier<R> partiallyApply(T param)
param
- Input param toNested apply toNested this functionpublic FluentFunctions.FluentFunction<T,R> memoize()
public FluentFunctions.FluentFunction<T,R> memoize(Cacheable<R> cache)
public FluentFunctions.FluentFunction<T,R> name(java.lang.String name)
name
- To give this Functionpublic FluentFunctions.FluentFunction<T,R> log(java.util.function.Consumer<java.lang.String> logger, java.util.function.Consumer<java.lang.Throwable> error)
logger
- Success loggererror
- Failure loggerpublic FluentFunctions.FluentFunction<T,R> visitEvent(java.util.function.Consumer<R> eventConsumer, java.util.function.Consumer<java.lang.Throwable> errorConsumer)
eventConsumer
- Consumer toNested recieve result on successful executionerrorConsumer
- Consumer toNested recieve error on failurepublic FluentFunctions.FluentFunction<T,R> println()
public <X extends java.lang.Throwable> FluentFunctions.FluentFunction<T,R> recover(java.lang.Class<X> type, java.util.function.Function<T,R> onError)
type
- Recoverable exception typesonError
- Recovery functionpublic FluentFunctions.FluentFunction<T,R> retry(int times, int backoffStartTime)
times
- Number of times toNested retrybackoffStartTime
- Wait time before first retrypublic ReactiveSeq<R> iterate(T seed, java.util.function.Function<R,T> mapToType)
FluentFunctions.of(this::addOne)
.iterate(95281,i->i)
.forEach(System.out::println);
//95282
//95283
//95284
//95285
//95286
//etc
seed
- initial valuemapToType
- Convert from supplied function return type toNested Stream input typepublic ReactiveSeq<R> generate(T input)
input
- Input value, this function will applied toNested this value toNested generate the value that will be infinitely repeated in this StreamReactiveSeq
of values determined by the application
of this function toNested the input valuepublic <X extends java.lang.Throwable> FluentFunctions.FluentFunction<T,Try<R,X>> liftTry(java.lang.Class<X>... classes)
classes
- To catch exceptions forpublic FluentFunctions.FluentFunction<T,java.util.concurrent.CompletableFuture<R>> liftAsync(java.util.concurrent.Executor ex)
ex
- Executor toNested execute this function onpublic java.util.concurrent.CompletableFuture<FluentFunctions.FluentFunction<T,R>> async(java.util.concurrent.Executor ex)
ex
- Executor toNested manage operations on this function onpublic <V> FluentFunctions.FluentFunction<V,R> compose(java.util.function.Function<? super V,? extends T> before)