Class Converter
java.lang.Object
de.team33.patterns.exceptional.dione.Converter
A tool class that can convert certain functional constructs defined in this module (e.g.
XFunction)
to more common ones (e.g. Function) that, when executed, will wrap any occurring checked exception in a
specific unchecked exception. Any unchecked exception that may occur will remain unaffected.
Use using(Function) to get an instance.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionfinal <T,U> BiConsumer<T, U> biConsumer(XBiConsumer<? super T, ? super U, ?> xBiConsumer) Converts anXBiConsumerthat may throw a checked exception to aBiConsumerthat, when executed, wraps any occurring checked exception as a specific unchecked exception.final <T,U, R> BiFunction<T, U, R> biFunction(XBiFunction<? super T, ? super U, ? extends R, ?> xBiFunction) Converts anXBiFunctionthat may throw a checked exception to aBiFunctionthat, when executed, wraps any occurring checked exception as a specific unchecked exception.final <T,U> BiPredicate<T, U> biPredicate(XBiPredicate<? super T, ? super U, ?> xBiPredicate) Converts anXBiPredicatethat may throw a checked exception to aBiPredicatethat, when executed, wraps any occurring checked exception as a specific unchecked exception.final <T> Consumer<T>final <T,R> Function<T, R> final <R> RReturns the result of a givenXSupplierand wraps any checked exception that may occur as a specific unchecked exception.final <T> Predicate<T>predicate(XPredicate<? super T, ?> xPredicate) Converts anXPredicatethat may throw a checked exception to aPredicatethat, when executed, wraps any occurring checked exception as a specific unchecked exception.final voidRuns a givenXRunnablethat wraps a checked exception that may occur as a specific unchecked exception.final Runnablefinal <R> Supplier<R>static Converterusing(Function<? super Throwable, ? extends RuntimeException> wrapping) Returns a new instance using a given wrapping method.
-
Method Details
-
using
Returns a new instance using a given wrapping method. -
runnable
Converts anXRunnablethat may throw a checked exception to aRunnablethat, when executed, wraps any occurring checked exception as a specific unchecked exception.- See Also:
-
consumer
Converts anXConsumerthat may throw a checked exception to aConsumerthat, when executed, wraps any occurring checked exception as a specific unchecked exception.- See Also:
-
biConsumer
Converts anXBiConsumerthat may throw a checked exception to aBiConsumerthat, when executed, wraps any occurring checked exception as a specific unchecked exception.- See Also:
-
supplier
Converts anXSupplierthat may throw a checked exception to aSupplierthat, when executed, wraps any occurring checked exception as a specific unchecked exception.- See Also:
-
predicate
Converts anXPredicatethat may throw a checked exception to aPredicatethat, when executed, wraps any occurring checked exception as a specific unchecked exception.- See Also:
-
biPredicate
Converts anXBiPredicatethat may throw a checked exception to aBiPredicatethat, when executed, wraps any occurring checked exception as a specific unchecked exception.- See Also:
-
function
Converts anXFunctionthat may throw a checked exception to aFunctionthat, when executed, wraps any occurring checked exception as a specific unchecked exception.- See Also:
-
biFunction
public final <T,U, BiFunction<T,R> U, biFunctionR> (XBiFunction<? super T, ? super U, ? extends R, ?> xBiFunction) Converts anXBiFunctionthat may throw a checked exception to aBiFunctionthat, when executed, wraps any occurring checked exception as a specific unchecked exception.- See Also:
-
run
Runs a givenXRunnablethat wraps a checked exception that may occur as a specific unchecked exception.- See Also:
-
get
Returns the result of a givenXSupplierand wraps any checked exception that may occur as a specific unchecked exception.- Type Parameters:
R- The result type.- See Also:
-