java.lang.Runnable@FunctionalInterface
public interface ThrowingRunnable
extends java.lang.Runnable
| Modifier and Type | Method | Description |
|---|---|---|
default java.lang.Runnable |
fallbackTo(java.lang.Runnable fallback) |
Returns a
Runnable performing the given operation if this operation throws an exception. |
default java.lang.Runnable |
fallbackTo(java.lang.Runnable fallback,
java.util.function.Consumer<java.lang.Exception> exceptionConsumer) |
Returns a
Runnable performing the given operation if this operation throws an exception. |
default java.lang.Runnable |
orDoNothing() |
Returns a
Runnable performing no other operation if this operation throws an exception. |
default java.lang.Runnable |
orDoNothing(java.util.function.Consumer<java.lang.Exception> exceptionConsumer) |
Returns a
Runnable performing no other operation if this operation throws an exception. |
default ThrowingRunnable |
orThrow(java.lang.Class<? extends java.lang.RuntimeException> exceptionClass) |
Returns a
ThrowingRunnable throwing an exception of the given type if this operation throws an exception. |
default ThrowingRunnable |
orThrow(java.lang.Class<? extends java.lang.RuntimeException> exceptionClass,
java.lang.String message) |
Returns a
ThrowingRunnable throwing an exception of the given type if this operation throws an exception. |
default ThrowingRunnable |
orTryWith(ThrowingRunnable other) |
Returns a
ThrowingRunnable performing the given operation if this operation throws an exception. |
default ThrowingRunnable |
orTryWith(ThrowingRunnable other,
java.util.function.Consumer<java.lang.Exception> exceptionConsumer) |
Returns a
ThrowingRunnable performing the given operation if this operation throws an exception. |
default void |
run() |
Performs this operation.
|
void |
runThrowing() |
Performs this operation.
|
default java.lang.Runnable fallbackTo(java.lang.Runnable fallback)
Runnable performing the given operation if this operation throws an exception.java.lang.IllegalArgumentException - if fallback is nulldefault java.lang.Runnable fallbackTo(java.lang.Runnable fallback,
java.util.function.Consumer<java.lang.Exception> exceptionConsumer)
Runnable performing the given operation if this operation throws an exception.java.lang.IllegalArgumentException - if fallback is nulldefault java.lang.Runnable orDoNothing()
Runnable performing no other operation if this operation throws an exception.java.lang.IllegalArgumentException - if fallback is nulldefault java.lang.Runnable orDoNothing(java.util.function.Consumer<java.lang.Exception> exceptionConsumer)
Runnable performing no other operation if this operation throws an exception.java.lang.IllegalArgumentException - if fallback is nulldefault ThrowingRunnable orThrow(java.lang.Class<? extends java.lang.RuntimeException> exceptionClass)
ThrowingRunnable throwing an exception of the given type if this operation throws an exception.
The original exception thrown by this operation is the cause of the thrown exception.
The exception class must have a constructor accepting a single Throwable as an argument.
java.lang.IllegalArgumentException - if exceptionClass is nulldefault ThrowingRunnable orThrow(java.lang.Class<? extends java.lang.RuntimeException> exceptionClass, java.lang.String message)
ThrowingRunnable throwing an exception of the given type if this operation throws an exception.
The original exception thrown by this operation is the cause of the thrown exception.
The exception class must have a constructor accepting String and Throwable as arguments.
java.lang.IllegalArgumentException - if exceptionClass is nulldefault ThrowingRunnable orTryWith(ThrowingRunnable other)
ThrowingRunnable performing the given operation if this operation throws an exception.java.lang.IllegalArgumentException - if other is nulldefault ThrowingRunnable orTryWith(ThrowingRunnable other, java.util.function.Consumer<java.lang.Exception> exceptionConsumer)
ThrowingRunnable performing the given operation if this operation throws an exception.java.lang.IllegalArgumentException - if other is nulldefault void run()
UncheckedException.run in interface java.lang.Runnablevoid runThrowing()
throws java.lang.Exception
java.lang.Exception