接口 ThrowableSupplier<T>
-
- 函数接口:
- 这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。
@FunctionalInterface public interface ThrowableSupplier<T>
-
-
方法概要
所有方法 静态方法 实例方法 抽象方法 默认方法 修饰符和类型 方法 说明 default T
execute()
Executeget()
withthe default exception handling
static <T> T
execute(ThrowableSupplier<T> supplier)
ExecutesThrowableSupplier
withthe default exception handling
static <T> T
execute(ThrowableSupplier<T> supplier, java.util.function.Function<java.lang.Throwable,T> exceptionHandler)
ExecutesThrowableSupplier
with the customizedexception
handlingdefault T
execute(java.util.function.Function<java.lang.Throwable,T> exceptionHandler)
Executeget()
with the customizedexception
handlingT
get()
Applies this function to the given argument.default T
handleException(java.lang.Throwable failure)
Handle any exception that theget()
method throws
-
-
-
方法详细资料
-
get
T get() throws java.lang.Throwable
Applies this function to the given argument.- 返回:
- the supplied result
- 抛出:
java.lang.Throwable
- if met with any error
-
execute
default T execute()
Executeget()
withthe default exception handling
- 返回:
- the supplied result
- 另请参阅:
get()
-
execute
default T execute(java.util.function.Function<java.lang.Throwable,T> exceptionHandler)
Executeget()
with the customizedexception
handling
-
handleException
default T handleException(java.lang.Throwable failure)
Handle any exception that theget()
method throws- 参数:
failure
- the instance ofThrowable
- 返回:
- the result after the exception handling
-
execute
static <T> T execute(ThrowableSupplier<T> supplier) throws java.lang.NullPointerException
ExecutesThrowableSupplier
withthe default exception handling
- 类型参数:
T
- the supplied type- 参数:
supplier
-ThrowableSupplier
- 返回:
- the result after execution
- 抛出:
java.lang.NullPointerException
- ifsupplier
isnull
-
execute
static <T> T execute(ThrowableSupplier<T> supplier, java.util.function.Function<java.lang.Throwable,T> exceptionHandler) throws java.lang.NullPointerException
ExecutesThrowableSupplier
with the customizedexception
handling- 类型参数:
T
- the supplied type- 参数:
supplier
-ThrowableSupplier
exceptionHandler
- the handler to handle anyexception
that theget()
method throws- 返回:
- the result after execution
- 抛出:
java.lang.NullPointerException
- ifsupplier
orexceptionHandler
isnull
-
-