T - the type of the operand and result of the operatorExceptionHandlerSupport<T,E>, FunctionWithException<T,T,E>, ObjectReturnExceptionHandlerSupport<Function<T,R>,Function<T,Optional<R>>,Function<T,CompletionStage<R>>,R>@FunctionalInterface public interface UnaryOperatorWithException<T,E extends Exception> extends FunctionWithException<T,T,E>
FunctionWithException for the case where the operand and result are
of the same type.
As this interface must return the same type of the input, a lifted version
which returns Optional is not possible.
T apply(T t) throws E - The
functional method.UnaryOperator<T>Function<T,Optional<T>UnaryOperator<T>FunctionWithException,
UnaryOperator| Modifier and Type | Method | Description |
|---|---|---|
static <T,E extends Exception> |
failing(Supplier<E> exceptionBuilder) |
Returns a unary operator that always throw exception.
|
static <T,E extends Exception> |
identity() |
Returns a unary operator that always returns its input argument.
|
default UnaryOperator<T> |
ignore() |
Converts this
UnaryOperatorWithException to a lifted
UnaryOperator returning null in case of exception. |
static <T,E extends Exception> |
ignored(UnaryOperatorWithException<T,E> function) |
Converts a
UnaryOperatorWithException to a lifted
UnaryOperator returning null in case of exception. |
static <T,E extends Exception> |
lifted(UnaryOperatorWithException<T,E> function) |
Converts a
UnaryOperatorWithException to a lifted Function
returning Optional. |
default UnaryOperator<T> |
uncheck() |
Converts this
UnaryOperatorWithException to a UnaryOperator
that wraps exception to RuntimeException. |
static <T,E extends Exception> |
unchecked(UnaryOperatorWithException<T,E> function) |
Converts a
UnaryOperatorWithException to a UnaryOperator that
wraps exception to RuntimeException. |
static <T,E extends Exception> |
unchecked(UnaryOperatorWithException<T,E> function,
Function<Exception,RuntimeException> exceptionMapper) |
Converts a
UnaryOperatorWithException to a UnaryOperator that
wraps exception to RuntimeException by using the provided mapping
function. |
exceptionMapper, exceptionMapperForandThen, apply, asBiFunction, asBiFunction, asCallable, asCallable, asConsumer, asConsumer, asRunnable, asRunnable, asSupplier, asSupplier, compose, ignored, lift, lifted, stage, staged, unchecked, uncheckednotThrowingHandler, staged, throwingHandler, uncheckeddefault UnaryOperator<T> uncheck()
UnaryOperatorWithException to a UnaryOperator
that wraps exception to RuntimeException.uncheck in interface ExceptionHandlerSupport<T,E extends Exception>uncheck in interface FunctionWithException<T,T,E extends Exception>uncheck in interface ObjectReturnExceptionHandlerSupport<Function<T,R>,Function<T,Optional<R>>,Function<T,CompletionStage<R>>,R>FunctionWithException.unchecked(FunctionWithException),
FunctionWithException.unchecked(FunctionWithException, Function)default UnaryOperator<T> ignore()
UnaryOperatorWithException to a lifted
UnaryOperator returning null in case of exception.ignore in interface ExceptionHandlerSupport<T,E extends Exception>ignore in interface FunctionWithException<T,T,E extends Exception>ignore in interface ObjectReturnExceptionHandlerSupport<Function<T,R>,Function<T,Optional<R>>,Function<T,CompletionStage<R>>,R>FunctionWithException.ignored(FunctionWithException)static <T,E extends Exception> UnaryOperatorWithException<T,E> identity()
T - the type of the input and output of the operatorE - the type of the potential exceptionFunction.identity()static <T,E extends Exception> UnaryOperatorWithException<T,E> failing(Supplier<E> exceptionBuilder)
T - the type of the input and output of the operatorE - the type of the exceptionexceptionBuilder - the supplier to create the exceptionstatic <T,E extends Exception> UnaryOperator<T> unchecked(UnaryOperatorWithException<T,E> function)
UnaryOperatorWithException to a UnaryOperator that
wraps exception to RuntimeException.T - the type of the input and output of the operatorE - the type of the potential exceptionfunction - to be uncheckedNullPointerException - if function is nulluncheck(),
unchecked(UnaryOperatorWithException, Function)static <T,E extends Exception> UnaryOperator<T> unchecked(UnaryOperatorWithException<T,E> function, Function<Exception,RuntimeException> exceptionMapper)
UnaryOperatorWithException to a UnaryOperator that
wraps exception to RuntimeException by using the provided mapping
function.T - the type of the input and output of the operatorE - 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(UnaryOperatorWithException)static <T,E extends Exception> Function<T,Optional<T>> lifted(UnaryOperatorWithException<T,E> function)
UnaryOperatorWithException to a lifted Function
returning Optional.T - the type of the input and output of the operatorE - the type of the potential exceptionfunction - to be liftedNullPointerException - if function is nullignore()static <T,E extends Exception> UnaryOperator<T> ignored(UnaryOperatorWithException<T,E> function)
UnaryOperatorWithException to a lifted
UnaryOperator returning null in case of exception.T - the type of the input and output of the operatorE - the type of the potential exceptionfunction - to be liftedNullPointerException - if function is nullignore()Copyright © 2019. All rights reserved.