Class Ignoring<X extends Exception>

java.lang.Object
de.team33.patterns.exceptional.dione.Ignoring<X>

public final class Ignoring<X extends Exception> extends Object
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 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

      public final void run(XRunnable<? extends X> runnable)
      Runs a given XRunnable ignoring an exception that may occur.
      See Also:
    • get

      public final <R> Optional<R> get(XSupplier<? extends R,? extends X> supplier)
      Returns the result of running a given XSupplier ignoring an exception that may occur.
      Type Parameters:
      R - The result type.
      See Also: