public static class FluentFunctions.FluentTriFunction<T1,T2,T3,R> extends java.lang.Object implements Function3<T1,T2,T3,R>
Function1.FunctionalOperations<T1,R>
Constructor and Description |
---|
FluentTriFunction(Function3<T1,T2,T3,R> fn) |
Modifier and Type | Method and Description |
---|---|
FluentFunctions.FluentTriFunction<T1,T2,T3,R> |
after(Consumer4<T1,T2,T3,R> action)
Apply after advice to this TriFunction
|
<R2> FluentFunctions.FluentTriFunction<T1,T2,T3,R2> |
andThen3(java.util.function.Function<? super R,? extends R2> after)
Compose this TriFunction with the provided function into a single TriFunction.
|
R |
apply(T1 t1,
T2 t2,
T3 t3) |
FluentFunctions.FluentTriFunction<T1,T2,T3,R> |
around(java.util.function.Function<FluentFunctions.Advice3<T1,T2,T3,R>,R> around)
Apply around advic to this TriFunction
|
java.util.concurrent.CompletableFuture<FluentFunctions.FluentTriFunction<T1,T2,T3,R>> |
async(java.util.concurrent.Executor ex)
Move this function into an asynchronous context
|
FluentFunctions.FluentTriFunction<T1,T2,T3,R> |
before(Consumer3<T1,T2,T3> action)
Apply before advice to this TriFunction
|
FluentFunctions.FluentFunction<? super T1,Function1<? super T2,Function1<? super T3,? extends R>>> |
curry()
Curry this BiFunction, that is convert it from a TriFunction that accepts thre input parameters to a 'chain'
of three Functions that accept a single parameter
|
ReactiveSeq<R> |
generate(T1 input1,
T2 input2,
T3 input3)
Generate an infinite Stream by applying the input parameters to this function
repeatedly
|
ReactiveSeq<R> |
iterate(T1 seed1,
T2 seed2,
T3 seed3,
java.util.function.Function<R,Tuple3<T1,T2,T3>> mapToType)
Generate an infinite Stream from the provided seed values and mapping function.
|
FluentFunctions.FluentTriFunction<T1,T2,T3,java.util.concurrent.CompletableFuture<R>> |
liftAsync(java.util.concurrent.Executor ex)
Convert this TriFunction into one that executes asynchronously and returns a CompleteableFuture with the result
|
FluentFunctions.FluentTriFunction<Option<T1>,Option<T2>,Option<T3>,Option<R>> |
liftOption() |
<X extends java.lang.Throwable> |
liftTry(java.lang.Class<X>... classes) |
FluentFunctions.FluentTriFunction<T1,T2,T3,R> |
log(java.util.function.Consumer<java.lang.String> logger,
java.util.function.Consumer<java.lang.Throwable> error)
A TriFunction that logs it's success or error states to the provided Consumers
|
FluentFunctions.FluentTriFunction<T1,T2,T3,R> |
memoize3() |
FluentFunctions.FluentTriFunction<T1,T2,T3,R> |
memoize3(Cacheable<R> cache)
This methods creates a caching version of this BiFunction, caching is implemented via the Cacheable wrapper,
that can be used to wrap any concrete cache implementation
E.g.
|
FluentFunctions.FluentTriFunction<T1,T2,T3,R> |
name(java.lang.String name) |
FluentFunctions.FluentBiFunction<T2,T3,R> |
partiallyApply(T1 param)
Partially applyHKT the provided parameter as the first parameter to this TriFunction to generate a Function (single input value)
|
FluentFunctions.FluentFunction<T3,R> |
partiallyApply(T1 param1,
T2 param2)
Partially applyHKT the provided parameters to this BiFunction to generate a Function (single input)
|
FluentFunctions.FluentSupplier<R> |
partiallyApply(T1 param1,
T2 param2,
T3 param3)
Partially applyHKT the provided parameters to this TriFunction to generate a Supplier (that takes no inputs)
|
FluentFunctions.FluentTriFunction<T1,T2,T3,R> |
println() |
<X extends java.lang.Throwable> |
recover(java.lang.Class<X> type,
Function3<T1,T2,T3,R> onError)
A TriFunction that can recover from the specified exception types, using the provided recovery Function
|
FluentFunctions.FluentTriFunction<T1,T2,T3,R> |
retry(int times,
int backoffStartTime)
A TriFunction capable of retrying on failure using an exponential backoff strategy
|
FluentFunctions.FluentTriFunction<T1,T2,T3,R> |
visitEvent(java.util.function.Consumer<R> eventConsumer,
java.util.function.Consumer<java.lang.Throwable> errorConsumer)
Visit the result of this TriFunction once it has been executed, if the Function executes successfully the
result will be passes to the eventConsumer, if there is an error it will be passed to the errorConsumer
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
apply, apply, lift3, lift3, liftOpt3, liftTry3, memoize3Async, memoize3Async, toType3, λ, λv
after, always, andThen, andThen, applyLazy, before, bind, compose, fanIn, firstFn, functionOps, later, leftFn, lift, lift, liftNT, liftOpt, liftTry, memoize, memoize, memoizeAsync, memoizeAsync, merge, narrow, now, product, product, product, reader, rightFn, secondFn, toType, λ, λv
public FluentFunctions.FluentTriFunction<T1,T2,T3,R> before(Consumer3<T1,T2,T3> action)
action
- C3 to recieve the input parameters to TriFunctionpublic FluentFunctions.FluentTriFunction<T1,T2,T3,R> after(Consumer4<T1,T2,T3,R> action)
action
- C4 to recieve the input parameters and result from this TriFunctionpublic FluentFunctions.FluentTriFunction<T1,T2,T3,R> around(java.util.function.Function<FluentFunctions.Advice3<T1,T2,T3,R>,R> around)
FluentFunctions.of((a,b,c)->a+b+c)
.around(advice->advice.proceed1(advice.param1+1))
.println()
.applyHKT(10,1,0)
//12
around
- Function that gives controlling access to this Function via the Advice inout parameterpublic FluentFunctions.FluentBiFunction<T2,T3,R> partiallyApply(T1 param)
param
- Input parameter to Partially Appliedpublic FluentFunctions.FluentFunction<T3,R> partiallyApply(T1 param1, T2 param2)
param1
- First Input parameterparam2
- Second Input parameterpublic FluentFunctions.FluentSupplier<R> partiallyApply(T1 param1, T2 param2, T3 param3)
param1
- First Input parameterparam2
- Second Input parameterparam3
- Third Input parameterpublic FluentFunctions.FluentFunction<? super T1,Function1<? super T2,Function1<? super T3,? extends R>>> curry()
public int add(Integer a,Integer b, Integer c ){
return a+b;
}
FluentFunctions.of(this::add)
.curry()
.applyHKT(1)
.applyHKT(2)
.applyHKT(3);
//6
public FluentFunctions.FluentTriFunction<T1,T2,T3,R> memoize3()
public FluentFunctions.FluentTriFunction<T1,T2,T3,R> memoize3(Cacheable<R> cache)
Cache<Object, Integer> cache = CacheBuilder.newBuilder()
.maximumSize(1000)
.expireAfterWrite(10, TimeUnit.MINUTES)
.build();
called=0;
TriFunction<Integer,Integer,Integer> fn = FluentFunctions.of(this::add)
.name("myFunction")
.memoize3((key,f)->cache.getValue(key,()->f.applyHKT(key)));
fn.applyHKT(10,1,4);
fn.applyHKT(10,1,4);
fn.applyHKT(10,1,4);
assertThat(called,equalTo(1));
public FluentFunctions.FluentTriFunction<T1,T2,T3,R> name(java.lang.String name)
name
- To give this TriFunctionpublic FluentFunctions.FluentTriFunction<T1,T2,T3,R> log(java.util.function.Consumer<java.lang.String> logger, java.util.function.Consumer<java.lang.Throwable> error)
logger
- Success loggererror
- Failure loggerpublic FluentFunctions.FluentTriFunction<T1,T2,T3,R> visitEvent(java.util.function.Consumer<R> eventConsumer, java.util.function.Consumer<java.lang.Throwable> errorConsumer)
eventConsumer
- Consumer to recieve result on successful executionerrorConsumer
- Consumer to recieve error on failurepublic FluentFunctions.FluentTriFunction<T1,T2,T3,R> println()
public <X extends java.lang.Throwable> FluentFunctions.FluentTriFunction<T1,T2,T3,R> recover(java.lang.Class<X> type, Function3<T1,T2,T3,R> onError)
type
- Recoverable exception typesonError
- Recovery BiFunctionpublic FluentFunctions.FluentTriFunction<T1,T2,T3,R> retry(int times, int backoffStartTime)
times
- Number of times to retrybackoffStartTime
- Wait time before first retrypublic ReactiveSeq<R> iterate(T1 seed1, T2 seed2, T3 seed3, java.util.function.Function<R,Tuple3<T1,T2,T3>> mapToType)
FluentFunctions.of(this::add)
.iterate(1,2,3,(i)->Tuple.tuple(i,i,i))
.limit(2)
.printOut();
//6
18
seed1
- Initial input parameter 1seed2
- Initial input parameter 2seed3
- Initial input parameter 3mapToType
- Reversed mapping functionpublic ReactiveSeq<R> generate(T1 input1, T2 input2, T3 input3)
input1
- First input parameterinput2
- Second input parameterinput3
- Third input parameterpublic FluentFunctions.FluentTriFunction<Option<T1>,Option<T2>,Option<T3>,Option<R>> liftOption()
@SafeVarargs public final <X extends java.lang.Throwable> FluentFunctions.FluentTriFunction<T1,T2,T3,Try<R,X>> liftTry(java.lang.Class<X>... classes)
classes
- Classes to catch exceptions forpublic FluentFunctions.FluentTriFunction<T1,T2,T3,java.util.concurrent.CompletableFuture<R>> liftAsync(java.util.concurrent.Executor ex)
ex
- Executor to execute this TriFunction onpublic java.util.concurrent.CompletableFuture<FluentFunctions.FluentTriFunction<T1,T2,T3,R>> async(java.util.concurrent.Executor ex)
ex
- Executor to manage operations on this function onpublic <R2> FluentFunctions.FluentTriFunction<T1,T2,T3,R2> andThen3(java.util.function.Function<? super R,? extends R2> after)