public class CheckFunctionUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <T,R> io.vavr.CheckedFunction0<R> |
andThen(io.vavr.CheckedFunction0<T> function,
io.vavr.CheckedFunction2<T,java.lang.Throwable,R> handler)
Returns a composed function that first applies the function and then applies BiFunction
after to the result. |
static <T> io.vavr.CheckedFunction0<T> |
recover(io.vavr.CheckedFunction0<T> function,
io.vavr.CheckedFunction1<java.lang.Throwable,T> exceptionHandler)
Returns a composed function that first executes the function and optionally recovers from an
exception.
|
static <X extends java.lang.Throwable,T> |
recover(io.vavr.CheckedFunction0<T> function,
java.lang.Class<X> exceptionType,
io.vavr.CheckedFunction1<java.lang.Throwable,T> exceptionHandler)
Returns a composed function that first executes the function and optionally recovers from an
exception.
|
static <T> io.vavr.CheckedFunction0<T> |
recover(io.vavr.CheckedFunction0<T> function,
java.util.List<java.lang.Class<? extends java.lang.Throwable>> exceptionTypes,
io.vavr.CheckedFunction1<java.lang.Throwable,T> exceptionHandler)
Returns a composed function that first executes the function and optionally recovers from an
exception.
|
static <T> io.vavr.CheckedFunction0<T> |
recover(io.vavr.CheckedFunction0<T> function,
java.util.function.Predicate<T> resultPredicate,
io.vavr.CheckedFunction1<T,T> resultHandler)
Returns a composed function that first executes the function and optionally recovers from a specific result.
|
public static <T> io.vavr.CheckedFunction0<T> recover(io.vavr.CheckedFunction0<T> function, io.vavr.CheckedFunction1<java.lang.Throwable,T> exceptionHandler)
T
- return type of afterfunction
- the function which should be recovered from a certain exceptionexceptionHandler
- the exception handlerpublic static <T,R> io.vavr.CheckedFunction0<R> andThen(io.vavr.CheckedFunction0<T> function, io.vavr.CheckedFunction2<T,java.lang.Throwable,R> handler)
after
to the result.T
- return type of callableR
- return type of handlerfunction
- the functionhandler
- the function applied after callablepublic static <T> io.vavr.CheckedFunction0<T> recover(io.vavr.CheckedFunction0<T> function, java.util.function.Predicate<T> resultPredicate, io.vavr.CheckedFunction1<T,T> resultHandler)
T
- return type of afterfunction
- the functionresultPredicate
- the result predicateresultHandler
- the result handlerpublic static <T> io.vavr.CheckedFunction0<T> recover(io.vavr.CheckedFunction0<T> function, java.util.List<java.lang.Class<? extends java.lang.Throwable>> exceptionTypes, io.vavr.CheckedFunction1<java.lang.Throwable,T> exceptionHandler)
T
- return type of afterfunction
- the function which should be recovered from a certain exceptionexceptionTypes
- the specific exception types that should be recoveredexceptionHandler
- the exception handlerpublic static <X extends java.lang.Throwable,T> io.vavr.CheckedFunction0<T> recover(io.vavr.CheckedFunction0<T> function, java.lang.Class<X> exceptionType, io.vavr.CheckedFunction1<java.lang.Throwable,T> exceptionHandler)
T
- return type of afterfunction
- the function which should be recovered from a certain exceptionexceptionType
- the specific exception type that should be recoveredexceptionHandler
- the exception handler