From 0f196f59c6a4cb76ab8409da62ff1f35505f94a8 Mon Sep 17 00:00:00 2001 From: Dico Karssiens Date: Sun, 11 Nov 2018 14:06:45 +0000 Subject: Changes I made before breaking my local repository. Hoping this works. --- .../checkedfunctions/CheckedBiFunction.java | 152 ++++++++++----------- 1 file changed, 76 insertions(+), 76 deletions(-) (limited to 'dicore3/core/src/main/java/io/dico/dicore/exceptions/checkedfunctions/CheckedBiFunction.java') diff --git a/dicore3/core/src/main/java/io/dico/dicore/exceptions/checkedfunctions/CheckedBiFunction.java b/dicore3/core/src/main/java/io/dico/dicore/exceptions/checkedfunctions/CheckedBiFunction.java index 9b39325..11fca3f 100644 --- a/dicore3/core/src/main/java/io/dico/dicore/exceptions/checkedfunctions/CheckedBiFunction.java +++ b/dicore3/core/src/main/java/io/dico/dicore/exceptions/checkedfunctions/CheckedBiFunction.java @@ -1,76 +1,76 @@ -package io.dico.dicore.exceptions.checkedfunctions; - -import io.dico.dicore.exceptions.ExceptionHandler; - -import java.util.function.BiFunction; - -/** - * checked mimic of {@link BiFunction} - * - * @param - * @param - * @param - * @param - */ -@FunctionalInterface -public interface CheckedBiFunction - extends CheckedFunctionalObject, BiFunction { - - /** - * the functional method - * - * @param t the first input - * @param u the second input - * @return the function output - * @throws TException if an exception occurs - */ - TResult checkedApply(TParam1 t, TParam2 u) throws TException; - - /** - * unchecked wrapper for {@link #checkedApply(Object, Object)} - * If a {@link TException} occurs, an unchecked one might be thrown by {@link #resultOnError(Throwable, Object...)} - * - * @param t the first input - * @param u the second input - * @return the function output, or the result from {@link #resultOnError(Throwable, Object...)} if an exception was thrown - * @see #checkedApply(Object, Object) - * @see #resultOnError(Throwable, Object...) - */ - @Override - default TResult apply(TParam1 t, TParam2 u) { - try { - return checkedApply(t, u); - } catch (Throwable ex) { - return handleGenericException(ex, t, u); - } - } - - /** - * {@inheritDoc} - */ - @Override - default CheckedBiFunction handleExceptionsWith(ExceptionHandler handler) { - return new CheckedBiFunction() { - @Override - public TResult checkedApply(TParam1 t, TParam2 u) throws TException { - return CheckedBiFunction.this.checkedApply(t, u); - } - - @Override - @SuppressWarnings("unchecked") - public TResult handleGenericException(Throwable thrown, Object... args) { - Object result = handler.handleGenericException(thrown, args); - try { - return (TResult) result; - } catch (Exception ex) { - return null; - } - } - - @Override - public CheckedBiFunction handleExceptionsWith(ExceptionHandler handler) { - return CheckedBiFunction.this.handleExceptionsWith(handler); - } - }; - } -} +package io.dico.dicore.exceptions.checkedfunctions; + +import io.dico.dicore.exceptions.ExceptionHandler; + +import java.util.function.BiFunction; + +/** + * checked mimic of {@link BiFunction} + * + * @param + * @param + * @param + * @param + */ +@FunctionalInterface +public interface CheckedBiFunction + extends CheckedFunctionalObject, BiFunction { + + /** + * the functional method + * + * @param t the first input + * @param u the second input + * @return the function output + * @throws TException if an exception occurs + */ + TResult checkedApply(TParam1 t, TParam2 u) throws TException; + + /** + * unchecked wrapper for {@link #checkedApply(Object, Object)} + * If a {@link TException} occurs, an unchecked one might be thrown by {@link #resultOnError(Throwable, Object...)} + * + * @param t the first input + * @param u the second input + * @return the function output, or the result from {@link #resultOnError(Throwable, Object...)} if an exception was thrown + * @see #checkedApply(Object, Object) + * @see #resultOnError(Throwable, Object...) + */ + @Override + default TResult apply(TParam1 t, TParam2 u) { + try { + return checkedApply(t, u); + } catch (Throwable ex) { + return handleGenericException(ex, t, u); + } + } + + /** + * {@inheritDoc} + */ + @Override + default CheckedBiFunction handleExceptionsWith(ExceptionHandler handler) { + return new CheckedBiFunction() { + @Override + public TResult checkedApply(TParam1 t, TParam2 u) throws TException { + return CheckedBiFunction.this.checkedApply(t, u); + } + + @Override + @SuppressWarnings("unchecked") + public TResult handleGenericException(Throwable thrown, Object... args) { + Object result = handler.handleGenericException(thrown, args); + try { + return (TResult) result; + } catch (Exception ex) { + return null; + } + } + + @Override + public CheckedBiFunction handleExceptionsWith(ExceptionHandler handler) { + return CheckedBiFunction.this.handleExceptionsWith(handler); + } + }; + } +} -- cgit v1.2.3