public static class FluentFunctions.FluentSupplier<R>
extends java.lang.Object
implements java.util.function.Supplier<R>
Constructor and Description |
---|
FluentSupplier(java.util.function.Supplier<R> fn) |
Modifier and Type | Method and Description |
---|---|
FluentFunctions.FluentSupplier<R> |
after(java.util.function.Consumer<R> action)
Apply after advice to this Supplier
|
FluentFunctions.FluentSupplier<R> |
around(java.util.function.Function<FluentFunctions.Advice0<R>,R> around)
Apply around advice to this Supplier
|
java.util.concurrent.CompletableFuture<FluentFunctions.FluentSupplier<R>> |
async(java.util.concurrent.Executor ex) |
FluentFunctions.FluentSupplier<R> |
before(java.lang.Runnable r)
Apply before advice to this Supplier
|
ReactiveSeq<R> |
generate() |
R |
get() |
FluentFunctions.FluentSupplier<java.util.Optional<R>> |
lift() |
FluentFunctions.FluentSupplier<java.util.concurrent.CompletableFuture<R>> |
liftAsync(java.util.concurrent.Executor ex) |
FluentFunctions.FluentSupplier<AnyM<R>> |
liftM() |
<X extends java.lang.Throwable> |
liftTry(java.lang.Class<X>... classes) |
FluentFunctions.FluentSupplier<R> |
log(java.util.function.Consumer<java.lang.String> logger,
java.util.function.Consumer<java.lang.Throwable> error)
A supplier that logs it's success or error states to the provided Consumers
|
<R1> FluentFunctions.FluentSupplier<R1> |
matches(java.util.function.Function<Matchable.CheckValue1<R,R1>,Matchable.CheckValue1<R,R1>> case1,
java.util.function.Supplier<? extends R1> otherwise)
A supplier that triggers an event if the result matches the case provided, or generates a new value from the supplier
provided if not
|
FluentFunctions.FluentSupplier<R> |
memoize() |
FluentFunctions.FluentSupplier<R> |
memoize(Cacheable<R> cache) |
FluentFunctions.FluentSupplier<R> |
name(java.lang.String name) |
FluentFunctions.FluentSupplier<R> |
println() |
<X extends java.lang.Throwable> |
recover(java.lang.Class<X> type,
java.util.function.Supplier<R> onError)
A supplier that can recover from the specified exception types, using the provided Supplier
|
FluentFunctions.FluentSupplier<R> |
retry(int times,
int backoffStartTime)
A supplier capable of retrying on failure using an exponential backoff strategy
|
public FluentSupplier(java.util.function.Supplier<R> fn)
public FluentFunctions.FluentSupplier<R> before(java.lang.Runnable r)
r
- Runnable that represents before advice (AOP)public FluentFunctions.FluentSupplier<R> after(java.util.function.Consumer<R> action)
action
- Runnable that represents after advice (AOP)public FluentFunctions.FluentSupplier<R> around(java.util.function.Function<FluentFunctions.Advice0<R>,R> around)
around
- Function that captures input to this Supplier and can optionally pass on the callpublic FluentFunctions.FluentSupplier<R> memoize()
public FluentFunctions.FluentSupplier<R> memoize(Cacheable<R> cache)
cache
- A cache implementation wrapperpublic FluentFunctions.FluentSupplier<R> name(java.lang.String name)
name
- To give this supplierpublic FluentFunctions.FluentSupplier<R> println()
public FluentFunctions.FluentSupplier<R> log(java.util.function.Consumer<java.lang.String> logger, java.util.function.Consumer<java.lang.Throwable> error)
logger
- Success loggererror
- Failure loggerpublic <X extends java.lang.Throwable> FluentFunctions.FluentSupplier<R> recover(java.lang.Class<X> type, java.util.function.Supplier<R> onError)
type
- Recoverable exception typesonError
- Supplier to use on errorpublic FluentFunctions.FluentSupplier<R> retry(int times, int backoffStartTime)
times
- Number of times to retrybackoffStartTime
- Wait time before first retrypublic <R1> FluentFunctions.FluentSupplier<R1> matches(java.util.function.Function<Matchable.CheckValue1<R,R1>,Matchable.CheckValue1<R,R1>> case1, java.util.function.Supplier<? extends R1> otherwise)
case1
- Case against which the value generated by this supplier will be comparedotherwise
- Supplier to generate an alterantive value if this value does not match the provided casepublic ReactiveSeq<R> generate()
public FluentFunctions.FluentSupplier<java.util.Optional<R>> lift()
public <X extends java.lang.Throwable> FluentFunctions.FluentSupplier<Try<R,X>> liftTry(java.lang.Class<X>... classes)
classes
- To catch exceptions forpublic FluentFunctions.FluentSupplier<AnyM<R>> liftM()
public FluentFunctions.FluentSupplier<java.util.concurrent.CompletableFuture<R>> liftAsync(java.util.concurrent.Executor ex)
ex
- Executor to execute this Supplier onpublic java.util.concurrent.CompletableFuture<FluentFunctions.FluentSupplier<R>> async(java.util.concurrent.Executor ex)
ex
- Executor to execute this Supplier on