FailableFunction
- @FunctionalInterface public abstract interface org.apache.commons.lang3.function.FailableFunction<T, R, E extends Throwable>[source]
A functional interface like
Functionthat declares aThrowable.- Parameters:
<T> – Input type 1.
<R> – Return type.
<E> – The type of thrown exception or error.
- Since:
3.11
Fields and constants
NOP singleton |
- @SuppressWarnings({"rawtypes"}) public static final FailableFunction NOP[source]
NOP singleton
Methods
Returns a composed |
|
Applies this function. |
|
Returns a composed |
|
Starts a fluent chain like |
|
Returns a function that always returns its input argument. |
|
Gets the NOP singleton. |
- public default <V> FailableFunction<T, V, E> andThen(FailableFunction<? super R, ? extends V, E> after)[source]
Returns a composed
FailableFunctionlikeFunction#andThen(Function).- Type parameters:
<V> – The output type of the
afterfunction, and of the composed function.- Returns:
A composed
FailableFunctionlikeFunction#andThen(Function).- Parameters:
after – The operation to perform after this one.
- Throws:
java.lang.NullPointerException – Thrown when
afteris null.
- public abstract R apply(T input) throws E[source]
Applies this function.
- Parameters:
input – The input for the function
- Returns:
The result of the function
- Throws:
E – Thrown when the function fails.
- public default <V> FailableFunction<V, R, E> compose(FailableFunction<? super V, ? extends T, E> before)[source]
Returns a composed
FailableFunctionlikeFunction#compose(Function).- Type parameters:
<V> – The input type to the
beforefunction, and to the composed function.- Parameters:
before – The operator to apply before this one.
- Returns:
A composed
FailableFunctionlikeFunction#compose(Function).- Throws:
java.lang.NullPointerException – Thrown if before is null.
- See also:
- public static <T, R, E extends Throwable> FailableFunction<T, R, E> function(FailableFunction<T, R, E> function)[source]
Starts a fluent chain like
function(foo::bar).andThen(...).andThen(...).apply(...);- Type parameters:
<T> – Input type.
<R> – Return type.
<E> – The type of thrown exception or error.
- Parameters:
function – The argument to return.
- Returns:
The argument
- Since:
3.14.0
- public static <T, E extends Throwable> FailableFunction<T, T, E> identity()[source]
Returns a function that always returns its input argument.
- Type parameters:
<T> – The type of the input and output objects to the function
<E> – The type of thrown exception or error.
- Returns:
A function that always returns its input argument
- @SuppressWarnings({"unchecked"}) public static <T, R, E extends Throwable> FailableFunction<T, R, E> nop()[source]
Gets the NOP singleton.
- Type parameters:
<T> – Consumed type.
<R> – Return type.
<E> – The type of thrown exception or error.
- Returns:
The NOP singleton.