Interface FunctionWithException<T,R,E extends Exception>
- 
- Type Parameters:
- T- the type of the input to the function
- R- the type of the result of the function
- E- the type of the potential exception of the function
 - All Superinterfaces:
- ExceptionHandlerSupport<Function<T,R>,Function<T,Optional<R>>,FunctionWithException<T,R,E>>,- ObjectReturnExceptionHandlerSupport<Function<T,R>,Function<T,Optional<R>>,Function<T,CompletionStage<R>>,R,FunctionWithException<T,R,E>>
 - All Known Subinterfaces:
- UnaryOperatorWithException<T,E>
 - 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 FunctionWithException<T,R,E extends Exception> extends ObjectReturnExceptionHandlerSupport<Function<T,R>,Function<T,Optional<R>>,Function<T,CompletionStage<R>>,R,FunctionWithException<T,R,E>> Represents a function that accepts one argument, may throw exception and produces a result.General contract- R apply(T t) throws E- The functional method.
- uncheck - Return a Function<T, R>
- lift - Return a Function<T, Optional<R>>
- ignore - Return a Function<T, R>
 - See Also:
- Function
 
- 
- 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Default Methods 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 theafterfunction to the result.Rapply(T t)Applies this function to the given argument.default <U> BiFunctionWithException<T,U,R,E>asBiFunction()Converts aFunctionWithExceptionto aBiFunctionWithException.static <T,U,R,E extends Exception>
 BiFunctionWithException<T,U,R,E>asBiFunction(FunctionWithException<T,R,E> function)Converts aFunctionWithExceptionto aBiFunctionWithException.static <T,R,E extends Exception>
 Callable<R>asCallable(FunctionWithException<T,R,E> function, T t)Converts aFunctionWithExceptionto aCallable.default Callable<R>asCallable(T t)Converts aFunctionWithExceptionto aCallable.default ConsumerWithException<T,E>asConsumer()Converts aFunctionWithExceptionto aConsumerWithException.static <T,R,E extends Exception>
 ConsumerWithException<T,E>asConsumer(FunctionWithException<T,R,E> function)Converts aFunctionWithExceptionto aConsumerWithException.static <T,R,E extends Exception>
 RunnableWithException<E>asRunnable(FunctionWithException<T,R,E> function, T t)Converts aFunctionWithExceptionto aRunnableWithException.default RunnableWithException<E>asRunnable(T t)Converts aFunctionWithExceptionto aRunnableWithException.static <T,R,E extends Exception>
 SupplierWithException<R,E>asSupplier(FunctionWithException<T,R,E> function, T t)Converts aFunctionWithExceptionto aSupplierWithException.default SupplierWithException<R,E>asSupplier(T t)Converts aFunctionWithExceptionto aSupplierWithException.default <V> FunctionWithException<V,R,E>compose(FunctionWithException<? super V,? extends T,? extends E> before)Returns a composed function that first applies thebeforefunction to its input, and then applies this function to the result.static <T,R,E extends Exception>
 FunctionWithException<T,R,E>failing(Supplier<E> exceptionBuilder)Returns a function that always throw exception.static <T,E extends Exception>
 FunctionWithException<T,T,E>identity()Returns a function that always returns its input argument.default Function<T,R>ignore()Converts thisFunctionWithExceptionto a liftedFunctionreturningnull(or the value redefined by the methodObjectReturnExceptionHandlerSupport.defaultValue()) in case of exception.static <T,R,E extends Exception>
 Function<T,R>ignored(FunctionWithException<T,R,E> function)Converts aFunctionWithExceptionto a liftedFunctionreturningnullin case of exception.static <T,R,E extends Exception>
 Function<T,R>ignored(FunctionWithException<T,R,E> function, R defaultValue)Converts aFunctionWithExceptionto a liftedFunctionreturning a default value in case of exception.default Function<T,Optional<R>>lift()Converts thisFunctionWithExceptionto a liftedFunctionusingOptionalas return value.static <T,R,E extends Exception>
 Function<T,Optional<R>>lifted(FunctionWithException<T,R,E> function)Converts aFunctionWithExceptionto a liftedFunctionusingOptionalas return value.default Function<T,CompletionStage<R>>stage()Convert thisFunctionWithExceptionto a liftedFunctionreturnCompletionStageas return value.static <T,R,E extends Exception>
 Function<T,CompletionStage<R>>staged(FunctionWithException<T,R,E> function)Convert thisFunctionWithExceptionto a liftedFunctionreturnCompletionStageas return value.default Function<T,R>uncheck()Converts thisFunctionWithExceptionto aFunctionthat convert exception toRuntimeException.static <T,R,E extends Exception>
 Function<T,R>unchecked(FunctionWithException<T,R,E> function)Converts aFunctionWithExceptionto aFunctionthat convert exception toRuntimeException.static <T,R,E extends Exception>
 Function<T,R>unchecked(FunctionWithException<T,R,E> function, Function<Exception,RuntimeException> exceptionMapper)Converts aFunctionWithExceptionto aFunctionthat wraps exception toRuntimeExceptionby using the provided mapping function.- 
Methods inherited from interface ch.powerunit.extensions.exceptions.ExceptionHandlerSupportdocumented, exceptionMapper
 - 
Methods inherited from interface ch.powerunit.extensions.exceptions.ObjectReturnExceptionHandlerSupportdefaultValue, notThrowingHandler, throwingHandler
 
- 
 
- 
- 
- 
Method Detail- 
applyR apply(T t) throws E extends Exception Applies this function to the given argument.- Parameters:
- t- the function argument
- Returns:
- the function result
- Throws:
- E- any exception
- E extends Exception
- See Also:
- Function.apply(Object)
 
 - 
uncheckdefault Function<T,R> uncheck() Converts thisFunctionWithExceptionto aFunctionthat convert exception toRuntimeException.- Specified by:
- uncheckin interface- ExceptionHandlerSupport<T,R,E extends Exception>
- Specified by:
- uncheckin interface- ObjectReturnExceptionHandlerSupport<Function<T,R>,Function<T,Optional<R>>,Function<T,CompletionStage<R>>,R,FunctionWithException<T,R,E extends Exception>>
- Returns:
- the unchecked function
- See Also:
- unchecked(FunctionWithException),- unchecked(FunctionWithException, Function),- Function
 
 - 
liftdefault Function<T,Optional<R>> lift() Converts thisFunctionWithExceptionto a liftedFunctionusingOptionalas return value.- Specified by:
- liftin interface- ExceptionHandlerSupport<T,R,E extends Exception>
- Specified by:
- liftin interface- ObjectReturnExceptionHandlerSupport<Function<T,R>,Function<T,Optional<R>>,Function<T,CompletionStage<R>>,R,FunctionWithException<T,R,E extends Exception>>
- Returns:
- the lifted function
- See Also:
- lifted(FunctionWithException),- Function
 
 - 
ignoredefault Function<T,R> ignore() Converts thisFunctionWithExceptionto a liftedFunctionreturningnull(or the value redefined by the methodObjectReturnExceptionHandlerSupport.defaultValue()) in case of exception.- Specified by:
- ignorein interface- ExceptionHandlerSupport<T,R,E extends Exception>
- Specified by:
- ignorein interface- ObjectReturnExceptionHandlerSupport<Function<T,R>,Function<T,Optional<R>>,Function<T,CompletionStage<R>>,R,FunctionWithException<T,R,E extends Exception>>
- Returns:
- the function that ignore error
- See Also:
- ignored(FunctionWithException),- Function
 
 - 
stagedefault Function<T,CompletionStage<R>> stage() Convert thisFunctionWithExceptionto a liftedFunctionreturnCompletionStageas return value.- Specified by:
- stagein interface- ObjectReturnExceptionHandlerSupport<Function<T,R>,Function<T,Optional<R>>,Function<T,CompletionStage<R>>,R,FunctionWithException<T,R,E extends Exception>>
- Returns:
- the lifted function
- See Also:
- staged(FunctionWithException),- CompletionStage
 
 - 
composedefault <V> FunctionWithException<V,R,E> compose(FunctionWithException<? super V,? extends T,? extends E> before) Returns a composed function that first applies thebeforefunction 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.- Type Parameters:
- V- the type of input to the- beforefunction, and to the composed function
- Parameters:
- before- the function to apply before this function is applied
- Returns:
- a composed function that first applies the beforefunction and then applies this function
- Throws:
- NullPointerException- if before is null
- See Also:
- andThen(FunctionWithException),- Function.compose(Function)
 
 - 
andThendefault <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 theafterfunction to the result. If evaluation of either function throws an exception, it is relayed to the caller of the composed function.- Type Parameters:
- V- the type of output of the- afterfunction, and of the composed function
- Parameters:
- after- the function to apply after this function is applied
- Returns:
- a composed function that first applies this function and then applies
         the afterfunction
- Throws:
- NullPointerException- if after is null *
- See Also:
- compose(FunctionWithException),- Function.andThen(Function)
 
 - 
identitystatic <T,E extends Exception> FunctionWithException<T,T,E> identity() 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 the potential exception
- Returns:
- a function that always returns its input argument
- See Also:
- Function.identity()
 
 - 
failingstatic <T,R,E extends Exception> FunctionWithException<T,R,E> failing(Supplier<E> exceptionBuilder) Returns a function that always throw exception.- Type Parameters:
- T- the type of the input to the function
- R- the type of the result of the function
- E- the type of the exception
- Parameters:
- exceptionBuilder- the supplier to create the exception
- Returns:
- a function that always throw exception
 
 - 
uncheckedstatic <T,R,E extends Exception> Function<T,R> unchecked(FunctionWithException<T,R,E> function) Converts aFunctionWithExceptionto aFunctionthat convert exception toRuntimeException.- Type Parameters:
- T- the type of the input to the function
- R- the type of the result of the function
- E- the type of the potential exception
- Parameters:
- function- to be unchecked
- Returns:
- the unchecked exception
- Throws:
- NullPointerException- if function is null
- See Also:
- uncheck(),- unchecked(FunctionWithException, Function)
 
 - 
uncheckedstatic <T,R,E extends Exception> Function<T,R> unchecked(FunctionWithException<T,R,E> function, Function<Exception,RuntimeException> exceptionMapper) Converts aFunctionWithExceptionto aFunctionthat wraps exception toRuntimeExceptionby using the provided mapping function.- Type Parameters:
- T- the type of the input to the function
- R- the type of the result of the function
- E- the type of the potential exception
- Parameters:
- function- the be unchecked
- exceptionMapper- a function to convert the exception to the runtime exception.
- Returns:
- the unchecked exception
- Throws:
- NullPointerException- if function or exceptionMapper is null
- See Also:
- uncheck(),- unchecked(FunctionWithException)
 
 - 
liftedstatic <T,R,E extends Exception> Function<T,Optional<R>> lifted(FunctionWithException<T,R,E> function) Converts aFunctionWithExceptionto a liftedFunctionusingOptionalas return value.- Type Parameters:
- T- the type of the input to the function
- R- the type of the result of the function
- E- the type of the potential exception
- Parameters:
- function- to be lifted
- Returns:
- the lifted function
- Throws:
- NullPointerException- if function is null
- See Also:
- lift()
 
 - 
ignoredstatic <T,R,E extends Exception> Function<T,R> ignored(FunctionWithException<T,R,E> function) Converts aFunctionWithExceptionto a liftedFunctionreturningnullin case of exception.- Type Parameters:
- T- the type of the input to the function
- R- the type of the result of the function
- E- the type of the potential exception
- Parameters:
- function- to be lifted
- Returns:
- the lifted function
- Throws:
- NullPointerException- if function is null
- See Also:
- ignore()
 
 - 
ignoredstatic <T,R,E extends Exception> Function<T,R> ignored(FunctionWithException<T,R,E> function, R defaultValue) Converts aFunctionWithExceptionto a liftedFunctionreturning a default value in case of exception.- Type Parameters:
- T- the type of the input to the function
- R- the type of the result of the function
- E- the type of the potential exception
- Parameters:
- function- to be lifted
- defaultValue- the value to be returned in case of exception.
- Returns:
- the lifted function
- Throws:
- NullPointerException- if function is null
- Since:
- 3.0.0
- See Also:
- ignore(),- ignored(FunctionWithException)
 
 - 
stagedstatic <T,R,E extends Exception> Function<T,CompletionStage<R>> staged(FunctionWithException<T,R,E> function) Convert thisFunctionWithExceptionto a liftedFunctionreturnCompletionStageas return value.- Type Parameters:
- T- the type of the input to the function
- R- the type of the result of the function
- E- the type of the potential exception
- Parameters:
- function- to be lifted
- Returns:
- the lifted function
- Throws:
- NullPointerException- if function is null
- See Also:
- stage()
 
 - 
asConsumerstatic <T,R,E extends Exception> ConsumerWithException<T,E> asConsumer(FunctionWithException<T,R,E> function) Converts aFunctionWithExceptionto aConsumerWithException.- Type Parameters:
- T- the type of the input to the function
- R- the type of the result of the function
- E- the type of the potential exception
- Parameters:
- function- to be converter
- Returns:
- the consumer
- Throws:
- NullPointerException- if function is null
- Since:
- 1.2.0
 
 - 
asConsumerdefault ConsumerWithException<T,E> asConsumer() Converts aFunctionWithExceptionto aConsumerWithException.- Returns:
- the consumer
- Since:
- 1.2.0
 
 - 
asBiFunctionstatic <T,U,R,E extends Exception> BiFunctionWithException<T,U,R,E> asBiFunction(FunctionWithException<T,R,E> function) Converts aFunctionWithExceptionto aBiFunctionWithException.- Type Parameters:
- T- the type of the input to the function
- U- the type of the second input to the function
- R- the type of the result of the function
- E- the type of the potential exception
- Parameters:
- function- to be converter
- Returns:
- the function
- Throws:
- NullPointerException- if function is null
- Since:
- 1.2.0
 
 - 
asBiFunctiondefault <U> BiFunctionWithException<T,U,R,E> asBiFunction() Converts aFunctionWithExceptionto aBiFunctionWithException.- Type Parameters:
- U- the type of the second input to the function
- Returns:
- the function
- Since:
- 1.2.0
 
 - 
asSupplierstatic <T,R,E extends Exception> SupplierWithException<R,E> asSupplier(FunctionWithException<T,R,E> function, T t) Converts aFunctionWithExceptionto aSupplierWithException.- Type Parameters:
- T- the type of the input to the function
- R- the type of the result of the function
- E- the type of the potential exception
- Parameters:
- function- to be converter
- t- The input to the function.
- Returns:
- the supplier
- Throws:
- NullPointerException- if function is null
- Since:
- 1.2.0
 
 - 
asSupplierdefault SupplierWithException<R,E> asSupplier(T t) Converts aFunctionWithExceptionto aSupplierWithException.- Parameters:
- t- The input to the function.
- Returns:
- the supplier
- Since:
- 1.2.0
 
 - 
asCallablestatic <T,R,E extends Exception> Callable<R> asCallable(FunctionWithException<T,R,E> function, T t) Converts aFunctionWithExceptionto aCallable.- Type Parameters:
- T- the type of the input to the function
- R- the type of the result of the function
- E- the type of the potential exception
- Parameters:
- function- to be converter
- t- The input to the function.
- Returns:
- the callable
- Throws:
- NullPointerException- if function is null
- Since:
- 1.2.0
 
 - 
asCallabledefault Callable<R> asCallable(T t) Converts aFunctionWithExceptionto aCallable.- Parameters:
- t- The input to the function.
- Returns:
- the callable
- Since:
- 1.2.0
 
 - 
asRunnablestatic <T,R,E extends Exception> RunnableWithException<E> asRunnable(FunctionWithException<T,R,E> function, T t) Converts aFunctionWithExceptionto aRunnableWithException.- Type Parameters:
- T- the type of the input to the function
- R- the type of the result of the function
- E- the type of the potential exception
- Parameters:
- function- to be converter
- t- The input to the function.
- Returns:
- the Runnable
- Throws:
- NullPointerException- if function is null
- Since:
- 1.2.0
 
 - 
asRunnabledefault RunnableWithException<E> asRunnable(T t) Converts aFunctionWithExceptionto aRunnableWithException.- Parameters:
- t- The input to the function.
- Returns:
- the Runnable
- Since:
- 1.2.0
 
 
- 
 
-