java.util.function, but
with throws Exception.
The various functional interface provided by this package exposes several dedicated methods :
uncheck() which converts the functional interface to the
once from java.util.function, having the checked Exception
wrapped in a RuntimeException. By default this will be an instance of
WrappedException.
An additional method unchecked(...) is provided to statically
create unchecked version of the functional interface.lift() and lifted(...) which converts the
functional interface to a version that either return an
Optional.empty() or a default value in case of error.ignore() and ignored(...) which converts
the functional interface to a version that return a default value in case of
error.uncheck... methods) by specifying a Function to compute
the target RuntimeException.
unchecked to directly create a
functional interface with only runtime exception :
FunctionWithException<String, String, IOException> fonctionThrowingException = ...; Function<String, String> functionThrowingRuntimeException = FunctionWithException.unchecked(fonctionThrowingException);When it is required to thrown a specific
RuntimeException, it is also
possible to specify it :
FunctionWithException<String, String, IOException> fonctionThrowingException = ...;
Function<String, String> functionThrowingRuntimeException =
FunctionWithException.unchecked(
fonctionThrowingException,
IllegalArgumentException::new
);
When the exception should not be thrown in case of error, it is possible to
create a Function with Optional result :
FunctionWithException<String, String, IOException> fonctionThrowingException = ...; Function<String, Optional<String>> functionWithOptionalResult = FunctionWithException.lifted(fonctionThrowingException);
java.util.function| Interface | Description |
|---|---|
| BiConsumerWithException<T,U,E extends Exception> |
Represents an operation that accepts two input arguments and returns no
result and may throw exception.
|
| BiFunctionWithException<T,U,R,E extends Exception> |
Represents a function that accepts two arguments, may thrown exception and
produces a result.
|
| BinaryOperatorWithException<T,E extends Exception> |
Represents an operation upon two operands of the same type, that may throw
exception, producing a result of the same type as the operands.
|
| BiPredicateWithException<T,U,E extends Exception> |
Represents a predicate (boolean-valued function) of two arguments that may
throw exception.
|
| BooleanSupplierWithException<E extends Exception> |
Represents a supplier of
boolean-valued results which may throw
exception. |
| ConsumerWithException<T,E extends Exception> |
Represents an operation that accepts a single input argument, may thrown
exception and returns no result.
|
| DoubleBinaryOperatorWithException<E extends Exception> |
Represents an operation upon two
double-valued operands, may throw
exception and producing a double-valued result. |
| DoubleConsumerWithException<E extends Exception> |
Represents an operation that accepts a single
double-valued argument,
may throw exception and returns no result. |
| DoubleFunctionWithException<R,E extends Exception> |
Represents a function that accepts a double-valued argument, may throw
exception and produces a result.
|
| DoublePredicateWithException<E extends Exception> |
Represents a predicate (boolean-valued function) of one
double-valued
argument that may throw exception. |
| DoubleSupplierWithException<E extends Exception> |
Represents a supplier of
double-valued results and may throw
exception. |
| DoubleToIntFunctionWithException<E extends Exception> |
Represents a function that accepts a double-valued argument, may throw
exception and produces an int-valued result.
|
| DoubleToLongFunctionWithException<E extends Exception> |
Represents a function that accepts a double-valued argument, may throw
exception and produces a long-valued result.
|
| DoubleUnaryOperatorWithException<E extends Exception> |
Represents an operation on a single
double-valued operand that may
thrown exception and produces a double-valued result. |
| ExceptionHandlerSupport<F,L> |
Root interface to support global operations related to exception handling.
|
| ExceptionMapper |
Interface to help create mapper function for exception wrapping.
|
| FileFilterWithException<E extends Exception> |
A filter for abstract pathnames and may throw an exception.
|
| FilenameFilterWithException<E extends Exception> |
Instances of classes that implement this interface are used to filter
filenames and may throw exception.
|
| FunctionWithException<T,R,E extends Exception> |
Represents a function that accepts one argument, may throw exception and
produces a result.
|
| IntBinaryOperatorWithException<E extends Exception> |
Represents an operation upon two
int-valued operands, may thrown
exception and producing an int-valued result. |
| IntConsumerWithException<E extends Exception> |
Represents an operation that accepts a single
int-valued argument,
may throw exception and returns no result. |
| IntFunctionWithException<R,E extends Exception> |
Represents a function that accepts an int-valued argument, may throw
exception and produces a result.
|
| IntPredicateWithException<E extends Exception> |
Represents a predicate (boolean-valued function) of one
int-valued
argument that may throw exception. |
| IntSupplierWithException<E extends Exception> |
Represents a supplier of
int-valued results and may throw exception. |
| IntToDoubleFunctionWithException<E extends Exception> |
Represents a function that accepts an int-valued argument, may throw an
exception and produces a double-valued result.
|
| IntToLongFunctionWithException<E extends Exception> |
Represents a function that accepts an int-valued argument, may thrown
exception and produces a long-valued result.
|
| IntUnaryOperatorWithException<E extends Exception> |
Represents an operation on a single
int-valued operand that produces
an int-valued result and may throws exception. |
| LongBinaryOperatorWithException<E extends Exception> |
Represents an operation upon two
long-valued operands and producing a
long-valued result which may throw exception. |
| LongConsumerWithException<E extends Exception> |
Represents an operation that accepts a single
long-valued argument,
may throw exception and returns no result. |
| LongFunctionWithException<R,E extends Exception> |
Represents a function that accepts a long-valued argument, may throw
exception and produces a result.
|
| LongPredicateWithException<E extends Exception> |
Represents a predicate (boolean-valued function) of one
long-valued
argument that may throw exception. |
| LongSupplierWithException<E extends Exception> |
Represents a supplier of
long-valued results and may throw exception. |
| LongToDoubleFunctionWithException<E extends Exception> |
Represents a function that accepts a long-valued argument, may throw an
exception and produces a double-valued result.
|
| LongToIntFunctionWithException<E extends Exception> |
Represents a function that accepts a long-valued argument, may throw
exception and produces an int-valued result.
|
| LongUnaryOperatorWithException<E extends Exception> |
Represents an operation on a single
long-valued operand, may thrown
exception and that produces a long-valued result. |
| NoReturnExceptionHandlerSupport<F,S> |
Root interface to support global operations related to exception handling for
functional interface without return value.
|
| ObjDoubleConsumerWithException<T,E extends Exception> |
Represents an operation that accepts an object-valued and a
double-valued argument, and returns no result. |
| ObjectInputFilterWithException<E extends Exception> |
Filter classes, array lengths, and graph metrics during deserialization that
may throw exception.
|
| ObjectReturnExceptionHandlerSupport<F,L,S,T> |
Root interface to support global operations related to exception handling for
functional interface returning Object result.
|
| ObjIntConsumerWithException<T,E extends Exception> |
Represents an operation that accepts an object-valued and a
int-valued argument, and returns no result. |
| ObjLongConsumerWithException<T,E extends Exception> |
Represents an operation that accepts an object-valued and a
long-valued argument, and returns no result. |
| PathMatcherWithException<E extends Exception> |
An interface that is implemented by objects that perform match operations on
paths and may throw an exception.
|
| PredicateWithException<T,E extends Exception> |
Represents a predicate (boolean-valued function) of one argument and may
throw an exception.
|
| PrimitiveReturnExceptionHandlerSupport<F> |
Root interface to support global operations related to exception handling for
functional interface with primitive return value.
|
| RunnableWithException<E extends Exception> |
Represents an operation that accepts no input argument and returns no result
and may throw exception.
|
| SupplierWithException<T,E extends Exception> |
Represents a supplier of results that may thrown exception.
|
| ToDoubleBiFunctionWithException<T,U,E extends Exception> |
Represents a function that accepts two arguments, may thrown exception and
produces a double-valued result.
|
| ToDoubleFunctionWithException<T,E extends Exception> |
Represents a function that produces a double-valued result, may throw
exception.
|
| ToIntBiFunctionWithException<T,U,E extends Exception> |
Represents a function that accepts two arguments and produces an int-valued
result.
|
| ToIntFunctionWithException<T,E extends Exception> |
Represents a function that produces an int-valued result and may throw
exception.
|
| ToLongBiFunctionWithException<T,U,E extends Exception> |
Represents a function that accepts two arguments, may throw exception and
produces a long-valued result.
|
| ToLongFunctionWithException<T,E extends Exception> |
Represents a function that produces a long-valued result and may throw
exception.
|
| UnaryOperatorWithException<T,E extends Exception> |
Represents an operation on a single operand that produces a result of the
same type as its operand.
|
| Exception | Description |
|---|---|
| WrappedException |
RuntimeException to wrap the Exception.
|
Copyright © 2019. All rights reserved.