Package org.fuchss.tools.lambda
Class LambdaConvert
java.lang.Object
org.fuchss.tools.lambda.LambdaConvert
A converter class to convert Functions/Consumers .. with
Exception to
"normal" Functions/Consumers/..- Author:
- Dominik Fuchss
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic <I1,I2, O> BiFunction<I1, I2, O> wrap(BiFunctionWithException<I1, I2, O> func, Consumer<Exception> handler) Wrap aBiFunctionWithExceptionto aBiFunction.static <I> Consumer<I>wrap(ConsumerWithException<I> consumer, Consumer<Exception> handler) Wrap aConsumerWithExceptionto aConsumer.static <I,O> Function<I, O> wrap(FunctionWithException<I, O> func, Consumer<Exception> handler) Wrap aFunctionWithExceptionto aFunction.static <O> Supplier<O>wrap(SupplierWithException<O> supplier, Consumer<Exception> handler) Wrap aSupplierWithExceptionto aSupplier.static VoidFunctionwrap(VoidFunctionWithException func, Consumer<Exception> handler) Wrap aVoidFunctionWithExceptionto aVoidFunction.
-
Field Details
-
NIL
This handler will do nothing. -
STACK_TRACE
This handler will print a stack trace.
-
-
Method Details
-
wrap
public static <I,O> Function<I,O> wrap(FunctionWithException<I, O> func, Consumer<Exception> handler) Wrap aFunctionWithExceptionto aFunction.- Type Parameters:
I- the input typeO- the output type- Parameters:
func- the functionhandler- the exception handler- Returns:
- the wrapped function
-
wrap
public static <I1,I2, BiFunction<I1,O> I2, wrapO> (BiFunctionWithException<I1, I2, O> func, Consumer<Exception> handler) Wrap aBiFunctionWithExceptionto aBiFunction.- Type Parameters:
I1- the input one typeI2- the input two typeO- the output type- Parameters:
func- the functionhandler- the exception handler- Returns:
- the wrapped function
-
wrap
Wrap aConsumerWithExceptionto aConsumer.- Type Parameters:
I- the input type- Parameters:
consumer- the consumerhandler- the exception handler- Returns:
- the wrapped consumer
-
wrap
Wrap aSupplierWithExceptionto aSupplier.- Type Parameters:
O- the output type- Parameters:
supplier- the supplierhandler- the exception handler- Returns:
- the wrapped supplier
-
wrap
Wrap aVoidFunctionWithExceptionto aVoidFunction.- Parameters:
func- the functionhandler- the exception handler- Returns:
- the wrapped function
-