Interface LongToDoubleFunctionWithException<E extends Exception>
-
- Type Parameters:
E- the type of the potential exception of the function
- All Superinterfaces:
ExceptionHandlerSupport<LongToDoubleFunction,LongToDoubleFunction,LongToDoubleFunctionWithException<E>>,PrimitiveReturnExceptionHandlerSupport<LongToDoubleFunction,LongToDoubleFunctionWithException<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 LongToDoubleFunctionWithException<E extends Exception> extends PrimitiveReturnExceptionHandlerSupport<LongToDoubleFunction,LongToDoubleFunctionWithException<E>>
Represents a function that accepts a long-valued argument, may throw an exception and produces a double-valued result. This is thelong-to-doubleprimitive specialization forFunctionWithException.General contract
double applyAsDouble(long value) throws E- The functional method.- uncheck - Return a
LongToDoubleFunction - lift - Return a
LongToDoubleFunction - ignore - Return a
LongToDoubleFunction
- See Also:
LongToDoubleFunction
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description doubleapplyAsDouble(long value)Applies this function to the given argument.default doubledefaultValue()Defines the default value returned by the ignore and ignored method.static <E extends Exception>
LongToDoubleFunctionWithException<E>failing(Supplier<E> exceptionBuilder)Returns a function that always throw exception.default LongToDoubleFunctionignore()Converts thisLongToDoubleFunctionWithExceptionto a liftedLongToDoubleFunctionreturning0in case of exception.static <E extends Exception>
LongToDoubleFunctionignored(LongToDoubleFunctionWithException<E> function)Converts aLongToDoubleFunctionWithExceptionto a liftedLongToDoubleFunctionreturning0in case of exception.static <E extends Exception>
LongToDoubleFunctionignored(LongToDoubleFunctionWithException<E> function, double defaultValue)Converts aLongToDoubleFunctionWithExceptionto a liftedLongToDoubleFunctionreturning a default value in case of exception.static <E extends Exception>
LongToDoubleFunctionlifted(LongToDoubleFunctionWithException<E> function)Converts aLongToDoubleFunctionWithExceptionto a liftedLongToDoubleFunctionreturning0in case of exception.default LongToDoubleFunctionuncheck()Converts thisLongToDoubleFunctionWithExceptionto aLongToDoubleFunctionthat wraps exception toRuntimeException.static <E extends Exception>
LongToDoubleFunctionunchecked(LongToDoubleFunctionWithException<E> function)Converts aLongToDoubleFunctionWithExceptionto aLongToDoubleFunctionthat wraps exception toRuntimeException.static <E extends Exception>
LongToDoubleFunctionunchecked(LongToDoubleFunctionWithException<E> function, Function<Exception,RuntimeException> exceptionMapper)Converts aLongToDoubleFunctionWithExceptionto aLongToDoubleFunctionthat wraps exception toRuntimeExceptionby using the provided mapping function.default LongToDoubleFunctionuncheckOrIgnore(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
lift
-
-
-
-
Method Detail
-
applyAsDouble
double applyAsDouble(long value) throws E extends Exception
Applies this function to the given argument.- Parameters:
value- the function argument- Returns:
- the function result
- Throws:
E- any exceptionE extends Exception- See Also:
LongToDoubleFunction.applyAsDouble(long)
-
uncheckOrIgnore
default LongToDoubleFunction uncheckOrIgnore(boolean uncheck)
Description copied from interface:PrimitiveReturnExceptionHandlerSupportUsed internally to implements the ignore or uncheck operation.- Specified by:
uncheckOrIgnorein interfacePrimitiveReturnExceptionHandlerSupport<LongToDoubleFunction,LongToDoubleFunctionWithException<E extends Exception>>- Parameters:
uncheck- create unchecked version of the function when true, else ignored version.- Returns:
- the function
-
uncheck
default LongToDoubleFunction uncheck()
Converts thisLongToDoubleFunctionWithExceptionto aLongToDoubleFunctionthat wraps exception toRuntimeException.- Specified by:
uncheckin interfaceExceptionHandlerSupport<LongToDoubleFunction,LongToDoubleFunction,LongToDoubleFunctionWithException<E extends Exception>>- Specified by:
uncheckin interfacePrimitiveReturnExceptionHandlerSupport<LongToDoubleFunction,LongToDoubleFunctionWithException<E extends Exception>>- Returns:
- the unchecked function
- See Also:
unchecked(LongToDoubleFunctionWithException),unchecked(LongToDoubleFunctionWithException, Function)
-
ignore
default LongToDoubleFunction ignore()
Converts thisLongToDoubleFunctionWithExceptionto a liftedLongToDoubleFunctionreturning0in case of exception.- Specified by:
ignorein interfaceExceptionHandlerSupport<LongToDoubleFunction,LongToDoubleFunction,LongToDoubleFunctionWithException<E extends Exception>>- Specified by:
ignorein interfacePrimitiveReturnExceptionHandlerSupport<LongToDoubleFunction,LongToDoubleFunctionWithException<E extends Exception>>- Returns:
- the function that ignore error (return 0 in this case)
- See Also:
ignored(LongToDoubleFunctionWithException)
-
failing
static <E extends Exception> LongToDoubleFunctionWithException<E> failing(Supplier<E> exceptionBuilder)
Returns a function that always throw exception.- Type Parameters:
E- the type of the exception- Parameters:
exceptionBuilder- the supplier to create the exception- Returns:
- a function that always throw exception
-
unchecked
static <E extends Exception> LongToDoubleFunction unchecked(LongToDoubleFunctionWithException<E> function)
Converts aLongToDoubleFunctionWithExceptionto aLongToDoubleFunctionthat wraps exception toRuntimeException.- Type Parameters:
E- the type of the potential exception- Parameters:
function- to be unchecked- Returns:
- the unchecked function
- Throws:
NullPointerException- if function is null- See Also:
uncheck(),unchecked(LongToDoubleFunctionWithException, Function)
-
unchecked
static <E extends Exception> LongToDoubleFunction unchecked(LongToDoubleFunctionWithException<E> function, Function<Exception,RuntimeException> exceptionMapper)
Converts aLongToDoubleFunctionWithExceptionto aLongToDoubleFunctionthat wraps exception toRuntimeExceptionby using the provided mapping function.- Type Parameters:
E- 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 is null- See Also:
uncheck(),unchecked(LongToDoubleFunctionWithException)
-
lifted
static <E extends Exception> LongToDoubleFunction lifted(LongToDoubleFunctionWithException<E> function)
Converts aLongToDoubleFunctionWithExceptionto a liftedLongToDoubleFunctionreturning0in case of exception.- Type Parameters:
E- 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 <E extends Exception> LongToDoubleFunction ignored(LongToDoubleFunctionWithException<E> function)
Converts aLongToDoubleFunctionWithExceptionto a liftedLongToDoubleFunctionreturning0in case of exception.- Type Parameters:
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()
-
ignored
static <E extends Exception> LongToDoubleFunction ignored(LongToDoubleFunctionWithException<E> function, double defaultValue)
Converts aLongToDoubleFunctionWithExceptionto a liftedLongToDoubleFunctionreturning a default value in case of exception.- Type Parameters:
E- 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:
ignore(),ignored(LongToDoubleFunctionWithException)
-
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
-
-