Class ExceptionHelper.Handler<T extends Throwable>

java.lang.Object
org.tentackle.common.ExceptionHelper.Handler<T>
Type Parameters:
T - the exception type
Enclosing class:
ExceptionHelper

public static class ExceptionHelper.Handler<T extends Throwable> extends Object
Exception handler.
See Also:
  • Constructor Details

    • Handler

      public Handler(Class<T> type, Consumer<T> consumer)
      Creates an exception handler.
      Parameters:
      type - the exception class
      consumer - the consumer to handle the exception
  • Method Details

    • appliesTo

      public boolean appliesTo(Throwable t)
      Checks if handler applies to the given exception.
      Parameters:
      t - the exception
      Returns:
      true if handler applies
    • handle

      public void handle(T t)
      Handles the exception.
      Parameters:
      t - the exception