接口 TodayStrategies.FailureHandler
- 封闭类:
- TodayStrategies
- 函数接口:
- 这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。
Strategy for handling a failure that occurs when instantiating a strategy.
- 另请参阅:
-
方法概要
修饰符和类型方法说明voidhandleFailure(Class<?> strategyType, String strategyImplementationName, Throwable failure) Handle thefailurethat occurred when instantiating thestrategyImplementationNamethat was expected to be of the givenstrategyType.handleMessage(BiConsumer<Supplier<String>, Throwable> messageHandler) Create a newTodayStrategies.FailureHandlerthat handles errors using a standard formatted message.Create a newTodayStrategies.FailureHandlerthat handles errors by logging trace messages.throwing()Create a newTodayStrategies.FailureHandlerthat handles errors by throwing anIllegalArgumentException.throwing(BiFunction<String, Throwable, ? extends RuntimeException> exceptionFactory) Create a newTodayStrategies.FailureHandlerthat handles errors by throwing an exception.
-
方法详细资料
-
handleFailure
Handle thefailurethat occurred when instantiating thestrategyImplementationNamethat was expected to be of the givenstrategyType.- 参数:
strategyType- the type of the strategystrategyImplementationName- the name of the strategy implementationfailure- the failure that occurred- 另请参阅:
-
throwing
Create a newTodayStrategies.FailureHandlerthat handles errors by throwing anIllegalArgumentException.- 返回:
- a new
TodayStrategies.FailureHandlerinstance - 另请参阅:
-
throwing
static TodayStrategies.FailureHandler throwing(BiFunction<String, Throwable, ? extends RuntimeException> exceptionFactory) Create a newTodayStrategies.FailureHandlerthat handles errors by throwing an exception.- 参数:
exceptionFactory- strategy used to create the exception- 返回:
- a new
TodayStrategies.FailureHandlerinstance
-
logging
Create a newTodayStrategies.FailureHandlerthat handles errors by logging trace messages.- 参数:
logger- the logger used to log messages- 返回:
- a new
TodayStrategies.FailureHandlerinstance
-
handleMessage
static TodayStrategies.FailureHandler handleMessage(BiConsumer<Supplier<String>, Throwable> messageHandler) Create a newTodayStrategies.FailureHandlerthat handles errors using a standard formatted message.- 参数:
messageHandler- the message handler used to handle the problem- 返回:
- a new
TodayStrategies.FailureHandlerinstance
-