Interface FunctionWithExceptions<T,R,E extends java.lang.Exception>
-
- Type Parameters:
T- the argument being passed to the function.R- the result of the function.E- the Exception thrown by the function.
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface FunctionWithExceptions<T,R,E extends java.lang.Exception>Functional interface used to wrap lambdas to add support for Exception handling.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description Rapply(T t)Calls the function.static <T,R,E extends java.lang.Exception>
java.util.function.Function<T,R>rethrowFunction(FunctionWithExceptions<T,R,E> function)Applies the function.static <E extends java.lang.Throwable>
voidthrowAsUnchecked(java.lang.Exception exception)Wrapper for Exception handling.static <T,R,E extends java.lang.Exception>
Runcheck(FunctionWithExceptions<T,R,E> function, T t)Applies the function.
-
-
-
Method Detail
-
rethrowFunction
static <T,R,E extends java.lang.Exception> java.util.function.Function<T,R> rethrowFunction(FunctionWithExceptions<T,R,E> function) throws E extends java.lang.Exception
Applies the function.- Parameters:
function- the function to apply.- Returns:
- the result of the function.
- Throws:
E- in case of Exception.E extends java.lang.Exception
-
uncheck
static <T,R,E extends java.lang.Exception> R uncheck(FunctionWithExceptions<T,R,E> function, T t)
Applies the function.- Parameters:
function- the function to apply.t- the parameter of the function.- Returns:
- the result of the function.
-
throwAsUnchecked
static <E extends java.lang.Throwable> void throwAsUnchecked(java.lang.Exception exception) throws E extends java.lang.ThrowableWrapper for Exception handling.- Parameters:
exception- the original Exception.- Throws:
E- , the Exception cast to the class we wish to return.E extends java.lang.Throwable
-
-