Interface ToDoubleBiFunctionWithException<T,U,E extends Exception>
-
- Type Parameters:
T
- the type of the first argument to the functionU
- the type of the second argument the functionE
- the type of the potential exception of the function
- All Superinterfaces:
ExceptionHandlerSupport<ToDoubleBiFunction<T,U>,ToDoubleBiFunction<T,U>,ToDoubleBiFunctionWithException<T,U,E>>
,PrimitiveReturnExceptionHandlerSupport<ToDoubleBiFunction<T,U>,ToDoubleBiFunctionWithException<T,U,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 ToDoubleBiFunctionWithException<T,U,E extends Exception> extends PrimitiveReturnExceptionHandlerSupport<ToDoubleBiFunction<T,U>,ToDoubleBiFunctionWithException<T,U,E>>
Represents a function that accepts two arguments, may thrown exception and produces a double-valued result. This is thedouble
-producing primitive specialization forBiFunctionWithException
.General contract
double applyAsDouble(T t, U u) throws E
- The functional method.- uncheck - Return a
ToDoubleBiFunction<T, U>
- lift - Return a
ToDoubleBiFunction<T, U>
- ignore - Return a
ToDoubleBiFunction<T, U>
- See Also:
ToDoubleBiFunction
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description double
applyAsDouble(T t, U u)
Applies this function to the given arguments.default double
defaultValue()
Defines the default value returned by the ignore and ignored method.static <T,U,E extends Exception>
ToDoubleBiFunctionWithException<T,U,E>failing(Supplier<E> exceptionBuilder)
Returns a function that always throw exception.static <T,U,E extends Exception>
ToDoubleBiFunction<T,U>ignored(ToDoubleBiFunctionWithException<T,U,E> function)
Converts aToDoubleBiFunctionWithException
to a liftedToDoubleBiFunction
returning0
in case of exception.static <T,U,E extends Exception>
ToDoubleBiFunction<T,U>ignored(ToDoubleBiFunctionWithException<T,U,E> function, double defaultValue)
Converts aToDoubleBiFunctionWithException
to a liftedToDoubleBiFunction
returning a default value in case of exception.static <T,U,E extends Exception>
ToDoubleBiFunction<T,U>lifted(ToDoubleBiFunctionWithException<T,U,E> function)
Converts aToDoubleBiFunctionWithException
to a liftedToDoubleBiFunction
returning0
in case of exception.static <T,U,E extends Exception>
ToDoubleBiFunction<T,U>unchecked(ToDoubleBiFunctionWithException<T,U,E> function)
Converts aToDoubleBiFunctionWithException
to aToDoubleBiFunction
that wraps exception toRuntimeException
.static <T,U,E extends Exception>
ToDoubleBiFunction<T,U>unchecked(ToDoubleBiFunctionWithException<T,U,E> function, Function<Exception,RuntimeException> exceptionMapper)
Converts aToDoubleBiFunctionWithException
to aToDoubleBiFunction
that wraps exception toRuntimeException
by using the provided mapping function.default ToDoubleBiFunction<T,U>
uncheckOrIgnore(boolean uncheck)
Used internally to implements the ignore or uncheck operation.-
Methods inherited from interface ch.powerunit.extensions.exceptions.ExceptionHandlerSupport
documented, exceptionMapper
-
Methods inherited from interface ch.powerunit.extensions.exceptions.PrimitiveReturnExceptionHandlerSupport
ignore, lift, uncheck
-
-
-
-
Method Detail
-
applyAsDouble
double applyAsDouble(T t, U u) throws E extends Exception
Applies this function to the given arguments.- Parameters:
t
- the first input argumentu
- the first second argument- Returns:
- the function result
- Throws:
E
- any exceptionE extends Exception
- See Also:
ToDoubleBiFunction.applyAsDouble(Object, Object)
-
uncheckOrIgnore
default ToDoubleBiFunction<T,U> uncheckOrIgnore(boolean uncheck)
Description copied from interface:PrimitiveReturnExceptionHandlerSupport
Used internally to implements the ignore or uncheck operation.- Specified by:
uncheckOrIgnore
in interfacePrimitiveReturnExceptionHandlerSupport<T,U>
- Parameters:
uncheck
- create unchecked version of the function when true, else ignored version.- Returns:
- the function
-
failing
static <T,U,E extends Exception> ToDoubleBiFunctionWithException<T,U,E> failing(Supplier<E> exceptionBuilder)
Returns a function that always throw exception.- Type Parameters:
T
- the type of the first argument to the functionU
- the type of the second argument the functionE
- the type of the exception- Parameters:
exceptionBuilder
- the supplier to create the exception- Returns:
- a function that always throw exception
-
unchecked
static <T,U,E extends Exception> ToDoubleBiFunction<T,U> unchecked(ToDoubleBiFunctionWithException<T,U,E> function)
Converts aToDoubleBiFunctionWithException
to aToDoubleBiFunction
that wraps exception toRuntimeException
.- Type Parameters:
T
- the type of the first argument to the functionU
- the type of the second argument the functionE
- the type of the potential exception- Parameters:
function
- to be unchecked- Returns:
- the unchecked function
- Throws:
NullPointerException
- if function is null- See Also:
PrimitiveReturnExceptionHandlerSupport.uncheck()
,unchecked(ToDoubleBiFunctionWithException, Function)
-
unchecked
static <T,U,E extends Exception> ToDoubleBiFunction<T,U> unchecked(ToDoubleBiFunctionWithException<T,U,E> function, Function<Exception,RuntimeException> exceptionMapper)
Converts aToDoubleBiFunctionWithException
to aToDoubleBiFunction
that wraps exception toRuntimeException
by using the provided mapping function.- Type Parameters:
T
- the type of the first argument to the functionU
- the type of the second argument the functionE
- the type of the potential exception- Parameters:
function
- the be uncheckedexceptionMapper
- a function to convert the exception to the runtime exception.- Returns:
- the unchecked function
- Throws:
NullPointerException
- if function or exception is null- See Also:
PrimitiveReturnExceptionHandlerSupport.uncheck()
,unchecked(ToDoubleBiFunctionWithException)
-
lifted
static <T,U,E extends Exception> ToDoubleBiFunction<T,U> lifted(ToDoubleBiFunctionWithException<T,U,E> function)
Converts aToDoubleBiFunctionWithException
to a liftedToDoubleBiFunction
returning0
in case of exception.- Type Parameters:
T
- the type of the first argument to the functionU
- the type of the second argument the functionE
- the type of the potential exception- Parameters:
function
- to be lifted- Returns:
- the lifted function
- Throws:
NullPointerException
- if function is null- See Also:
PrimitiveReturnExceptionHandlerSupport.lift()
-
ignored
static <T,U,E extends Exception> ToDoubleBiFunction<T,U> ignored(ToDoubleBiFunctionWithException<T,U,E> function)
Converts aToDoubleBiFunctionWithException
to a liftedToDoubleBiFunction
returning0
in case of exception.- Type Parameters:
T
- the type of the first argument to the functionU
- the type of the second argument the functionE
- the type of the potential exception- Parameters:
function
- to be lifted- Returns:
- the lifted function
- Throws:
NullPointerException
- if function is null- See Also:
PrimitiveReturnExceptionHandlerSupport.ignore()
-
ignored
static <T,U,E extends Exception> ToDoubleBiFunction<T,U> ignored(ToDoubleBiFunctionWithException<T,U,E> function, double defaultValue)
Converts aToDoubleBiFunctionWithException
to a liftedToDoubleBiFunction
returning a default value in case of exception.- Type Parameters:
T
- the type of the first argument to the functionU
- the type of the second argument the functionE
- the type of the potential exception- Parameters:
function
- to be lifteddefaultValue
- value in case of exception- Returns:
- the lifted function
- Throws:
NullPointerException
- if function is null- Since:
- 3.0.0
- See Also:
PrimitiveReturnExceptionHandlerSupport.ignore()
,ignored(ToDoubleBiFunctionWithException)
-
defaultValue
default double defaultValue()
Defines the default value returned by the ignore and ignored method.- Returns:
- the default value for the ignore/ignored method.
- Since:
- 3.0.0
-
-