Class Ignoring<X extends Exception>
java.lang.Object
de.team33.patterns.exceptional.dione.Ignoring<X>
A tool class that can ignore a specific (checked) exception type when executing a corresponding code fragment.
Use any(Class, Class[]) to get an instance.
-
Method Summary
Modifier and TypeMethodDescriptionany(Class<X> exceptionClass, Class<? extends RuntimeException>... additional) Returns a new instance by a given (checked) exceptionClass to be ignored.final <R> Optional<R>Returns the result of running a givenXSupplierignoring an exception that may occur.final voidRuns a givenXRunnableignoring an exception that may occur.
-
Method Details
-
any
@SafeVarargs public static <X extends Exception> Ignoring<X> any(Class<X> exceptionClass, Class<? extends RuntimeException>... additional) Returns a new instance by a given (checked) exceptionClass to be ignored. Optionally, additional (unchecked) exception types can be specified which should also be ignored. -
run
Runs a givenXRunnableignoring an exception that may occur.- See Also:
-
get
Returns the result of running a givenXSupplierignoring an exception that may occur.- Type Parameters:
R- The result type.- See Also:
-