Top Description Fields Methods
org.apache.commons.lang3.function

public Interface FailableFunction<T, R, E extends Throwable>

Annotations
@FunctionalInterface
Type Parameters
<T>
Input type 1.
<R>
Return type.
<E>
The type of thrown exception or error.
Imports
java.util.Objects, java.util.function.Function

A functional interface like Function that declares a Throwable.
Since
3.11

Field Summary

Modifier and TypeField and Description
public static final FailableFunction<T, R, E extends Throwable>
NOP

NOP singleton

Method Summary

Modifier and TypeMethod and Description
public default <
the output type of the after function, and of the composed function.
V
>
FailableFunction<T, V, E>
andThen(final FailableFunction<? super R, ? extends V, E>
the operation to perform after this one.
after
)

Returns a composed FailableFunction like Function#andThen(Function).

public R

Returns:

the result of the function
apply
(T
the input for the function
input
)

Applies this function.

public default <
the input type to the before function, and to the composed function.
V
>
FailableFunction<V, R, E>
compose(final FailableFunction<? super V, ? extends T, E>
the operator to apply before this one.
before
)

Returns a composed FailableFunction like Function#compose(Function).

public static <
Input type.
T
,
Return type.
R
,
The type of thrown exception or error.
E extends Throwable
>
FailableFunction<T, R, E>

Returns:

the argument
function
(final FailableFunction<T, R, E>
the argument to return.
function
)

Starts a fluent chain like function(foo::bar).andThen(...).andThen(...).apply(...);

public static <
the type of the input and output objects to the function
T
,
The type of thrown exception or error.
E extends Throwable
>
FailableFunction<T, T, E>

Returns:

a function that always returns its input argument
identity
()

Returns a function that always returns its input argument.

public static <
Consumed type.
T
,
Return type.
R
,
The type of thrown exception or error.
E extends Throwable
>
FailableFunction<T, R, E>

Returns:

The NOP singleton.
nop
()

Gets the NOP singleton.

Field Detail

NOPback to summary
public static final FailableFunction<T, R, E extends Throwable> NOP

NOP singleton

Annotations
@SuppressWarnings:rawtypes

Method Detail

andThenback to summary
public default <V> FailableFunction<T, V, E> andThen(final FailableFunction<? super R, ? extends V, E> after)

Returns a composed FailableFunction like Function#andThen(Function).

Parameters
<V>
the output type of the after function, and of the composed function.
after:FailableFunction<? super R, ? extends V, E>

the operation to perform after this one.

Returns:FailableFunction<T, V, E>

a composed FailableFunction like Function#andThen(Function).

Exceptions
NullPointerException:
when after is null.
applyback to summary
public R apply(T input) throws E

Applies this function.

Parameters
input:T

the input for the function

Returns:R

the result of the function

Exceptions
E:
Thrown when the function fails.
composeback to summary
public default <V> FailableFunction<V, R, E> compose(final FailableFunction<? super V, ? extends T, E> before)

Returns a composed FailableFunction like Function#compose(Function).

Parameters
<V>
the input type to the before function, and to the composed function.
before:FailableFunction<? super V, ? extends T, E>

the operator to apply before this one.

Returns:FailableFunction<V, R, E>

a composed FailableFunction like Function#compose(Function).

Exceptions
NullPointerException:
if before is null.
See Also
andThen(FailableFunction)
functionback to summary
public static <T, R, E extends Throwable> FailableFunction<T, R, E> function(final FailableFunction<T, R, E> function)

Starts a fluent chain like function(foo::bar).andThen(...).andThen(...).apply(...);

Parameters
<T>
Input type.
<R>
Return type.
<E>
The type of thrown exception or error.
function:FailableFunction<T, R, E>

the argument to return.

Returns:FailableFunction<T, R, E>

the argument

Since
3.14.0
identityback to summary
public static <T, E extends Throwable> FailableFunction<T, T, E> identity()

Returns a function that always returns its input argument.

Parameters
<T>
the type of the input and output objects to the function
<E>
The type of thrown exception or error.
Returns:FailableFunction<T, T, E>

a function that always returns its input argument

nopback to summary
public static <T, R, E extends Throwable> FailableFunction<T, R, E> nop()

Gets the NOP singleton.

Parameters
<T>
Consumed type.
<R>
Return type.
<E>
The type of thrown exception or error.
Returns:FailableFunction<T, R, E>

The NOP singleton.

Annotations
@SuppressWarnings:unchecked