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/CheckedRunnable.java | 124 ++++++++++----------- 1 file changed, 62 insertions(+), 62 deletions(-) (limited to 'dicore3/core/src/main/java/io/dico/dicore/exceptions/checkedfunctions/CheckedRunnable.java') diff --git a/dicore3/core/src/main/java/io/dico/dicore/exceptions/checkedfunctions/CheckedRunnable.java b/dicore3/core/src/main/java/io/dico/dicore/exceptions/checkedfunctions/CheckedRunnable.java index 55de6f8..110c988 100644 --- a/dicore3/core/src/main/java/io/dico/dicore/exceptions/checkedfunctions/CheckedRunnable.java +++ b/dicore3/core/src/main/java/io/dico/dicore/exceptions/checkedfunctions/CheckedRunnable.java @@ -1,62 +1,62 @@ -package io.dico.dicore.exceptions.checkedfunctions; - -import io.dico.dicore.exceptions.ExceptionHandler; - -/** - * checked mimic of {@link Runnable} - * - * @param - */ -@FunctionalInterface -public interface CheckedRunnable - extends CheckedFunctionalObject, Runnable { - - /** - * The runnable action - * - * @throws TException if an exception occurs - */ - void checkedRun() throws TException; - - /** - * Unchecked version of {@link #checkedRun()} - * If a {@link TException} occurs, an unchecked one might be thrown by {@link #resultOnError(Throwable, Object...)} - * - * @see #checkedRun() - * @see #resultOnError(Throwable, Object...) - */ - @Override - default void run() { - try { - checkedRun(); - } catch (Throwable ex) { - handleGenericException(ex); - } - } - - /** - * {@inheritDoc} - */ - @Override - default CheckedRunnable handleExceptionsWith(ExceptionHandler handler) { - return new CheckedRunnable() { - @Override - public void checkedRun() throws TException { - CheckedRunnable.this.checkedRun(); - } - - @Override - @SuppressWarnings("unchecked") - public Void handleGenericException(Throwable thrown, Object... args) { - handler.handleGenericException(thrown, args); - return null; - } - - @Override - public CheckedRunnable handleExceptionsWith(ExceptionHandler handler) { - return CheckedRunnable.this.handleExceptionsWith(handler); - } - }; - } - -} +package io.dico.dicore.exceptions.checkedfunctions; + +import io.dico.dicore.exceptions.ExceptionHandler; + +/** + * checked mimic of {@link Runnable} + * + * @param + */ +@FunctionalInterface +public interface CheckedRunnable + extends CheckedFunctionalObject, Runnable { + + /** + * The runnable action + * + * @throws TException if an exception occurs + */ + void checkedRun() throws TException; + + /** + * Unchecked version of {@link #checkedRun()} + * If a {@link TException} occurs, an unchecked one might be thrown by {@link #resultOnError(Throwable, Object...)} + * + * @see #checkedRun() + * @see #resultOnError(Throwable, Object...) + */ + @Override + default void run() { + try { + checkedRun(); + } catch (Throwable ex) { + handleGenericException(ex); + } + } + + /** + * {@inheritDoc} + */ + @Override + default CheckedRunnable handleExceptionsWith(ExceptionHandler handler) { + return new CheckedRunnable() { + @Override + public void checkedRun() throws TException { + CheckedRunnable.this.checkedRun(); + } + + @Override + @SuppressWarnings("unchecked") + public Void handleGenericException(Throwable thrown, Object... args) { + handler.handleGenericException(thrown, args); + return null; + } + + @Override + public CheckedRunnable handleExceptionsWith(ExceptionHandler handler) { + return CheckedRunnable.this.handleExceptionsWith(handler); + } + }; + } + +} -- cgit v1.2.3