public class SuppressedException extends RuntimeException
| 限定符 | 构造器和说明 |
|---|---|
protected |
SuppressedException(Throwable cause) |
| 限定符和类型 | 方法和说明 |
|---|---|
static <E extends Throwable> |
suppress(Runnable runnable) |
static <T,E extends Throwable> |
suppress(Supplier<T> supplier) |
static <E extends Throwable> |
unwrapExceptionCause(SuppressedException suppressed,
Class<E> exceptionClass) |
static void |
unwrapSuppressedException(Runnable runnable) |
static <E extends Throwable> |
unwrapSuppressedException(Runnable runnable,
Class<E> exception) |
static <T> T |
unwrapSuppressedException(Supplier<T> supplier) |
static <T,E extends Throwable> |
unwrapSuppressedException(Supplier<T> supplier,
Class<E> exceptionClass) |
static SuppressedException |
wrapException(Throwable cause) |
protected SuppressedException(Throwable cause)
public static <T,E extends Throwable> T suppress(Supplier<T> supplier)
E - The exception type.supplier - A supplier object which may throw some exceptionpublic static <E extends Throwable> void suppress(Runnable runnable)
E - The exception type.runnable - A supplier object which may throw some exceptionpublic static SuppressedException wrapException(Throwable cause)
cause - The original cause.public static <T,E extends Throwable> T unwrapSuppressedException(Supplier<T> supplier, Class<E> exceptionClass) throws E extends Throwable
T - The generic return type.E - The exception type.supplier - A supplier that will throw SuppressedExceptionexceptionClass - The class type to intercept and withUncheckedThrowable.E - The original exception, that was wrapped into a SuppressedException.E extends Throwablepublic static <T> T unwrapSuppressedException(Supplier<T> supplier) throws Throwable
T - The return type generic.supplier - A supplier that throws SuppressedExceptions.Throwable - any throwable cause attached to the SuppressedExceptionpublic static <E extends Throwable> void unwrapSuppressedException(Runnable runnable, Class<E> exception) throws E extends Throwable
E - The exception class generic type.runnable - A runnable that throws suppressed exceptionsexception - The exception class to intercept.E - The intercepted exception.E extends Throwablepublic static void unwrapSuppressedException(Runnable runnable) throws Throwable
runnable - A runnable that throws suppressed exceptionsThrowable - Any throwable caused that is intercepted from caught Suppressed Exceptions.public static <E extends Throwable> Optional<E> unwrapExceptionCause(SuppressedException suppressed, Class<E> exceptionClass)
E - The exception class type genericsuppressed - The caught suppressed exceptionexceptionClass - The exception class type to try extract from the caught exceptionCopyright © 2020 com.github.braisdom. All rights reserved.