Class ExceptionHelper.Handler<T extends java.lang.Throwable>

    • Constructor Summary

      Constructors 
      Constructor Description
      Handler​(java.lang.Class<T> type, java.util.function.Consumer<T> consumer)
      Creates an exception handler.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean appliesTo​(java.lang.Throwable t)
      Checks if handler applies to the given exception.
      void handle​(T t)
      Handles the exception.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Handler

        public Handler​(java.lang.Class<T> type,
                       java.util.function.Consumer<T> consumer)
        Creates an exception handler.
        Parameters:
        type - the exception class
        consumer - the consumer to handle the exception
    • Method Detail

      • appliesTo

        public boolean appliesTo​(java.lang.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