接口 ThrowableAction

  • 函数接口:
    这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。

    @FunctionalInterface
    public interface ThrowableAction
    A function interface for action with Throwable
    从以下版本开始:
    1.0.0
    另请参阅:
    Function, Throwable
    • 方法详细资料

      • execute

        void execute()
              throws java.lang.Throwable
        Executes the action
        抛出:
        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
        参数:
        exceptionHandler - the handler to handle any exception that the execute() method throws
        抛出:
        java.lang.NullPointerException - if exceptionHandler is null
      • handleException

        default void handleException​(java.lang.Throwable failure)
        Handle any exception that the execute() method throws
        参数:
        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
        参数:
        action - ThrowableAction
        exceptionHandler - the handler to handle any exception that the execute() method throws
        抛出:
        java.lang.NullPointerException - if action or exceptionHandler is null