public class ExceptionUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
ExceptionUtils.CheckedRunnable
Interface that mimics Runnable but can additionally throw checked exceptions.
|
Modifier and Type | Method and Description |
---|---|
static <T> T |
propagate(java.util.concurrent.Callable<T> callable)
Propagates checked exceptions as a runtime exception.
|
static <T,E extends java.lang.RuntimeException> |
propagate(java.util.concurrent.Callable<T> callable,
java.util.function.Function<java.lang.Exception,E> wrap)
Propagates checked exceptions as a specific runtime exception.
|
static void |
propagateVoid(ExceptionUtils.CheckedRunnable runnable)
Propagates checked exceptions as a runtime exception.
|
static <E extends java.lang.RuntimeException> |
propagateVoid(ExceptionUtils.CheckedRunnable runnable,
java.util.function.Function<java.lang.Exception,E> wrap)
Propagates checked exceptions as a specific runtime exception.
|
public static void propagateVoid(ExceptionUtils.CheckedRunnable runnable)
runnable
- The checked runnable.public static <E extends java.lang.RuntimeException> void propagateVoid(ExceptionUtils.CheckedRunnable runnable, java.util.function.Function<java.lang.Exception,E> wrap)
E
- The specific exception type.runnable
- The checked runnable.wrap
- A function that wraps an exception in a runtime exception.public static <T> T propagate(java.util.concurrent.Callable<T> callable)
T
- The function return type.callable
- The function.public static <T,E extends java.lang.RuntimeException> T propagate(java.util.concurrent.Callable<T> callable, java.util.function.Function<java.lang.Exception,E> wrap)
T
- The function return type.E
- The specific exception type.callable
- The function.wrap
- A function that wraps an exception in a runtime exception.