T - the type of the input to the functionR - the type of the result of the functionE - the type of the potential exception of the functionExceptionHandlerSupport<T,R>, ObjectReturnExceptionHandlerSupport<Function<T,R>,Function<T,Optional<R>>,Function<T,CompletionStage<R>>,R>UnaryOperatorWithException<T,E>@FunctionalInterface public interface FunctionWithException<T,R,E extends Exception> extends ObjectReturnExceptionHandlerSupport<Function<T,R>,Function<T,Optional<R>>,Function<T,CompletionStage<R>>,R>
R apply(T t) throws E - The
functional method.Function<T, R>Function<T, Optional<R>>Function<T, R>Function| Modifier and Type | Method | Description |
|---|---|---|
default <V> FunctionWithException<T,V,E> |
andThen(FunctionWithException<? super R,? extends V,? extends E> after) |
Returns a composed function that first applies this function to its input,
and then applies the
after function to the result. |
R |
apply(T t) |
Applies this function to the given argument.
|
default <U> BiFunctionWithException<T,U,R,E> |
asBiFunction() |
Converts a
FunctionWithException to a
BiFunctionWithException. |
static <T,U,R,E extends Exception> |
asBiFunction(FunctionWithException<T,R,E> function) |
Converts a
FunctionWithException to a
BiFunctionWithException. |
static <T,R,E extends Exception> |
asCallable(FunctionWithException<T,R,E> function,
T t) |
Converts a
FunctionWithException to a Callable. |
default Callable<R> |
asCallable(T t) |
Converts a
FunctionWithException to a Callable. |
default ConsumerWithException<T,E> |
asConsumer() |
Converts a
FunctionWithException to a ConsumerWithException. |
static <T,R,E extends Exception> |
asConsumer(FunctionWithException<T,R,E> function) |
Converts a
FunctionWithException to a ConsumerWithException. |
static <T,R,E extends Exception> |
asRunnable(FunctionWithException<T,R,E> function,
T t) |
Converts a
FunctionWithException to a RunnableWithException. |
default RunnableWithException<E> |
asRunnable(T t) |
Converts a
FunctionWithException to a RunnableWithException. |
static <T,R,E extends Exception> |
asSupplier(FunctionWithException<T,R,E> function,
T t) |
Converts a
FunctionWithException to a SupplierWithException. |
default SupplierWithException<R,E> |
asSupplier(T t) |
Converts a
FunctionWithException to a SupplierWithException. |
default <V> FunctionWithException<V,R,E> |
compose(FunctionWithException<? super V,? extends T,? extends E> before) |
Returns a composed function that first applies the
before function to
its input, and then applies this function to the result. |
static <T,R,E extends Exception> |
failing(Supplier<E> exceptionBuilder) |
Returns a function that always throw exception.
|
static <T,E extends Exception> |
identity() |
Returns a function that always returns its input argument.
|
default Function<T,R> |
ignore() |
Converts this
FunctionWithException to a lifted Function
returning null in case of exception. |
static <T,R,E extends Exception> |
ignored(FunctionWithException<T,R,E> function) |
Converts a
FunctionWithException to a lifted Function
returning null in case of exception. |
default Function<T,Optional<R>> |
lift() |
Converts this
FunctionWithException to a lifted Function
using Optional as return value. |
static <T,R,E extends Exception> |
lifted(FunctionWithException<T,R,E> function) |
Converts a
FunctionWithException to a lifted Function using
Optional as return value. |
default Function<T,CompletionStage<R>> |
stage() |
Convert this
FunctionWithException to a lifted Function
return CompletionStage as return value. |
static <T,R,E extends Exception> |
staged(FunctionWithException<T,R,E> function) |
Convert this
FunctionWithException to a lifted Function
return CompletionStage as return value. |
default Function<T,R> |
uncheck() |
Converts this
FunctionWithException to a Function that
convert exception to RuntimeException. |
static <T,R,E extends Exception> |
unchecked(FunctionWithException<T,R,E> function) |
Converts a
FunctionWithException to a Function that convert
exception to RuntimeException. |
static <T,R,E extends Exception> |
unchecked(FunctionWithException<T,R,E> function,
Function<Exception,RuntimeException> exceptionMapper) |
Converts a
FunctionWithException to a Function that wraps
exception to RuntimeException by using the provided mapping function. |
exceptionMapper, exceptionMapperFornotThrowingHandler, staged, throwingHandler, uncheckedR apply(T t) throws E extends Exception
t - the function argumentE - any exceptionE extends ExceptionFunction.apply(Object)default Function<T,R> uncheck()
FunctionWithException to a Function that
convert exception to RuntimeException.uncheck in interface ExceptionHandlerSupport<T,R>uncheck in interface ObjectReturnExceptionHandlerSupport<Function<T,R>,Function<T,Optional<R>>,Function<T,CompletionStage<R>>,R>unchecked(FunctionWithException),
unchecked(FunctionWithException, Function),
Functiondefault Function<T,Optional<R>> lift()
FunctionWithException to a lifted Function
using Optional as return value.lift in interface ExceptionHandlerSupport<T,R>lift in interface ObjectReturnExceptionHandlerSupport<Function<T,R>,Function<T,Optional<R>>,Function<T,CompletionStage<R>>,R>lifted(FunctionWithException),
Functiondefault Function<T,R> ignore()
FunctionWithException to a lifted Function
returning null in case of exception.ignore in interface ExceptionHandlerSupport<T,R>ignore in interface ObjectReturnExceptionHandlerSupport<Function<T,R>,Function<T,Optional<R>>,Function<T,CompletionStage<R>>,R>ignored(FunctionWithException),
Functiondefault Function<T,CompletionStage<R>> stage()
FunctionWithException to a lifted Function
return CompletionStage as return value.stage in interface ObjectReturnExceptionHandlerSupport<Function<T,R>,Function<T,Optional<R>>,Function<T,CompletionStage<R>>,R>staged(FunctionWithException),
CompletionStagedefault <V> FunctionWithException<V,R,E> compose(FunctionWithException<? super V,? extends T,? extends E> before)
before function to
its input, and then applies this function to the result. If evaluation of
either function throws an exception, it is relayed to the caller of the
composed function.V - the type of input to the before function, and to the
composed functionbefore - the function to apply before this function is appliedbefore function
and then applies this functionNullPointerException - if before is nullandThen(FunctionWithException),
Function.compose(Function)default <V> FunctionWithException<T,V,E> andThen(FunctionWithException<? super R,? extends V,? extends E> after)
after function to the result. If evaluation of
either function throws an exception, it is relayed to the caller of the
composed function.V - the type of output of the after function, and of the
composed functionafter - the function to apply after this function is appliedafter functionNullPointerException - if after is null *compose(FunctionWithException),
Function.andThen(Function)static <T,E extends Exception> FunctionWithException<T,T,E> identity()
T - the type of the input and output objects to the functionE - the type of the potential exceptionFunction.identity()static <T,R,E extends Exception> FunctionWithException<T,R,E> failing(Supplier<E> exceptionBuilder)
T - the type of the input to the functionR - the type of the result of the functionE - the type of the exceptionexceptionBuilder - the supplier to create the exceptionstatic <T,R,E extends Exception> Function<T,R> unchecked(FunctionWithException<T,R,E> function)
FunctionWithException to a Function that convert
exception to RuntimeException.T - the type of the input to the functionR - the type of the result of the functionE - the type of the potential exceptionfunction - to be uncheckedNullPointerException - if function is nulluncheck(),
unchecked(FunctionWithException, Function)static <T,R,E extends Exception> Function<T,R> unchecked(FunctionWithException<T,R,E> function, Function<Exception,RuntimeException> exceptionMapper)
FunctionWithException to a Function that wraps
exception to RuntimeException by using the provided mapping function.T - the type of the input to the functionR - the type of the result of the functionE - the type of the potential exceptionfunction - the be uncheckedexceptionMapper - a function to convert the exception to the runtime exception.NullPointerException - if function or exceptionMapper is nulluncheck(),
unchecked(FunctionWithException)static <T,R,E extends Exception> Function<T,Optional<R>> lifted(FunctionWithException<T,R,E> function)
FunctionWithException to a lifted Function using
Optional as return value.T - the type of the input to the functionR - the type of the result of the functionE - the type of the potential exceptionfunction - to be liftedNullPointerException - if function is nulllift()static <T,R,E extends Exception> Function<T,R> ignored(FunctionWithException<T,R,E> function)
FunctionWithException to a lifted Function
returning null in case of exception.T - the type of the input to the functionR - the type of the result of the functionE - the type of the potential exceptionfunction - to be liftedNullPointerException - if function is nullignore()static <T,R,E extends Exception> Function<T,CompletionStage<R>> staged(FunctionWithException<T,R,E> function)
FunctionWithException to a lifted Function
return CompletionStage as return value.T - the type of the input to the functionR - the type of the result of the functionE - the type of the potential exceptionfunction - to be liftedNullPointerException - if function is nullstage()static <T,R,E extends Exception> ConsumerWithException<T,E> asConsumer(FunctionWithException<T,R,E> function)
FunctionWithException to a ConsumerWithException.T - the type of the input to the functionR - the type of the result of the functionE - the type of the potential exceptionfunction - to be converterNullPointerException - if function is nulldefault ConsumerWithException<T,E> asConsumer()
FunctionWithException to a ConsumerWithException.static <T,U,R,E extends Exception> BiFunctionWithException<T,U,R,E> asBiFunction(FunctionWithException<T,R,E> function)
FunctionWithException to a
BiFunctionWithException.T - the type of the input to the functionU - the type of the second input to the functionR - the type of the result of the functionE - the type of the potential exceptionfunction - to be converterNullPointerException - if function is nulldefault <U> BiFunctionWithException<T,U,R,E> asBiFunction()
FunctionWithException to a
BiFunctionWithException.U - the type of the second input to the functionstatic <T,R,E extends Exception> SupplierWithException<R,E> asSupplier(FunctionWithException<T,R,E> function, T t)
FunctionWithException to a SupplierWithException.T - the type of the input to the functionR - the type of the result of the functionE - the type of the potential exceptionfunction - to be convertert - The input to the function.NullPointerException - if function is nulldefault SupplierWithException<R,E> asSupplier(T t)
FunctionWithException to a SupplierWithException.t - The input to the function.static <T,R,E extends Exception> Callable<R> asCallable(FunctionWithException<T,R,E> function, T t)
FunctionWithException to a Callable.T - the type of the input to the functionR - the type of the result of the functionE - the type of the potential exceptionfunction - to be convertert - The input to the function.NullPointerException - if function is nulldefault Callable<R> asCallable(T t)
FunctionWithException to a Callable.t - The input to the function.static <T,R,E extends Exception> RunnableWithException<E> asRunnable(FunctionWithException<T,R,E> function, T t)
FunctionWithException to a RunnableWithException.T - the type of the input to the functionR - the type of the result of the functionE - the type of the potential exceptionfunction - to be convertert - The input to the function.NullPointerException - if function is nulldefault RunnableWithException<E> asRunnable(T t)
FunctionWithException to a RunnableWithException.t - The input to the function.Copyright © 2019. All rights reserved.