接口 ThrowableConsumer<T>
-
- 类型参数:
T
- the source type
- 函数接口:
- 这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。
@FunctionalInterface public interface ThrowableConsumer<T>
Consumer
withThrowable
- 从以下版本开始:
- 1.0.0
- 另请参阅:
Function
,Throwable
-
-
方法概要
所有方法 静态方法 实例方法 抽象方法 默认方法 修饰符和类型 方法 说明 void
accept(T t)
Applies this function to the given argument.default void
execute(T t)
Executes#accept(T)
withthe default exception handling
static <T> void
execute(T t, ThrowableConsumer<T> consumer)
ExecutesThrowableConsumer
withthe default exception handling
static <T> void
execute(T t, ThrowableConsumer<T> consumer, java.util.function.BiConsumer<T,java.lang.Throwable> exceptionHandler)
ExecutesThrowableConsumer
with the customized exception handlingdefault void
execute(T t, java.util.function.BiConsumer<T,java.lang.Throwable> exceptionHandler)
Executes#accept(T)
with the customized exception handlingdefault void
handleException(T t, java.lang.Throwable failure)
Handle any exception that the#accept(T)
method throws
-
-
-
方法详细资料
-
accept
void accept(T t) throws java.lang.Throwable
Applies this function to the given argument.- 参数:
t
- the function argument- 抛出:
java.lang.Throwable
- if met with any error
-
execute
default void execute(T t)
Executes#accept(T)
withthe default exception handling
- 参数:
t
- the function argument- 另请参阅:
#accept(T)
-
execute
default void execute(T t, java.util.function.BiConsumer<T,java.lang.Throwable> exceptionHandler) throws java.lang.NullPointerException
Executes#accept(T)
with the customized exception handling- 参数:
t
- the function argumentexceptionHandler
- the handler to handle the function argument and the exception that the#accept(T)
method throws- 抛出:
java.lang.NullPointerException
- ifexceptionHandler
isnull
-
handleException
default void handleException(T t, java.lang.Throwable failure)
Handle any exception that the#accept(T)
method throws- 参数:
t
- the value to be consumedfailure
- the instance ofThrowable
-
execute
static <T> void execute(T t, ThrowableConsumer<T> consumer) throws java.lang.NullPointerException
ExecutesThrowableConsumer
withthe default exception handling
- 类型参数:
T
- the source type- 参数:
t
- the function argumentconsumer
-ThrowableConsumer
- 抛出:
java.lang.NullPointerException
- ifconsumer
isnull
-
execute
static <T> void execute(T t, ThrowableConsumer<T> consumer, java.util.function.BiConsumer<T,java.lang.Throwable> exceptionHandler) throws java.lang.NullPointerException
ExecutesThrowableConsumer
with the customized exception handling- 类型参数:
T
- the source type- 参数:
t
- the function argumentconsumer
-ThrowableConsumer
exceptionHandler
- the handler to handle anyexception
that the#accept(T)
()} method throws- 抛出:
java.lang.NullPointerException
- ifconsumer
andexceptionHandler
isnull
-
-