Class Conversion
java.lang.Object
de.team33.patterns.exceptional.dione.Conversion
A utility 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
WrappedException. Any unchecked exception that may occur will remain unaffected.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic <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 aWrappedException.static <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 aWrappedException.static <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 aWrappedException.static <T> Consumer<T>Converts anXConsumerthat may throw a checked exception to aConsumerthat, when executed, wraps any occurring checked exception as aWrappedException.static <T,R> Function<T, R> Converts anXFunctionthat may throw a checked exception to aFunctionthat, when executed, wraps any occurring checked exception as aWrappedException.static <R> RReturns the result of a givenXSupplierand wraps any checked exception that may occur as aWrappedException.static <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 aWrappedException.static voidRuns a givenXRunnablethat wraps a checked exception that may occur as aWrappedException.static RunnableConverts anXRunnablethat may throw a checked exception to aRunnablethat, when executed, wraps any occurring checked exception as aWrappedException.static <R> Supplier<R>Converts anXSupplierthat may throw a checked exception to aSupplierthat, when executed, wraps any occurring checked exception as aWrappedException.
-
Method Details
-
runnable
Converts anXRunnablethat may throw a checked exception to aRunnablethat, when executed, wraps any occurring checked exception as aWrappedException. -
consumer
Converts anXConsumerthat may throw a checked exception to aConsumerthat, when executed, wraps any occurring checked exception as aWrappedException. -
biConsumer
Converts anXBiConsumerthat may throw a checked exception to aBiConsumerthat, when executed, wraps any occurring checked exception as aWrappedException. -
supplier
Converts anXSupplierthat may throw a checked exception to aSupplierthat, when executed, wraps any occurring checked exception as aWrappedException. -
predicate
Converts anXPredicatethat may throw a checked exception to aPredicatethat, when executed, wraps any occurring checked exception as aWrappedException. -
biPredicate
Converts anXBiPredicatethat may throw a checked exception to aBiPredicatethat, when executed, wraps any occurring checked exception as aWrappedException. -
function
Converts anXFunctionthat may throw a checked exception to aFunctionthat, when executed, wraps any occurring checked exception as aWrappedException. -
biFunction
public static <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 aWrappedException. -
run
Runs a givenXRunnablethat wraps a checked exception that may occur as aWrappedException. -
get
Returns the result of a givenXSupplierand wraps any checked exception that may occur as aWrappedException.- Type Parameters:
R- The result type.
-