Interface ThrowableAction

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface ThrowableAction
    A function interface for action with Throwable
    Since:
    1.0.0
    See Also:
    Function, Throwable
    • Method Detail

      • execute

        void execute()
              throws java.lang.Throwable
        Executes the action
        Throws:
        java.lang.Throwable - if met with error
      • execute

        default void execute​(java.util.function.Consumer<java.lang.Throwable> exceptionHandler)
        Executes execute() with the customized exception handling
        Parameters:
        exceptionHandler - the handler to handle any exception that the execute() method throws
        Throws:
        java.lang.NullPointerException - if exceptionHandler is null
      • handleException

        default void handleException​(java.lang.Throwable failure)
        Handle any exception that the execute() method throws
        Parameters:
        failure - the instance of Throwable
      • execute

        static void execute​(ThrowableAction action,
                            java.util.function.Consumer<java.lang.Throwable> exceptionHandler)
                     throws java.lang.NullPointerException
        Executes ThrowableAction with the customized exception handling
        Parameters:
        action - ThrowableAction
        exceptionHandler - the handler to handle any exception that the execute() method throws
        Throws:
        java.lang.NullPointerException - if action or exceptionHandler is null