Package io.microsphere.lang.function
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 withThrowable
- Since:
- 1.0.0
- See Also:
Function
,Throwable
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
execute()
Executes the actionstatic void
execute(ThrowableAction action)
ExecutesThrowableAction
withthe default exception handling
static void
execute(ThrowableAction action, java.util.function.Consumer<java.lang.Throwable> exceptionHandler)
ExecutesThrowableAction
with the customizedexception
handlingdefault void
execute(java.util.function.Consumer<java.lang.Throwable> exceptionHandler)
Executesexecute()
with the customizedexception
handlingdefault void
handleException(java.lang.Throwable failure)
Handle any exception that theexecute()
method throws
-
-
-
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)
Executesexecute()
with the customizedexception
handling- Parameters:
exceptionHandler
- the handler to handle anyexception
that theexecute()
method throws- Throws:
java.lang.NullPointerException
- ifexceptionHandler
isnull
-
handleException
default void handleException(java.lang.Throwable failure)
Handle any exception that theexecute()
method throws- Parameters:
failure
- the instance ofThrowable
-
execute
static void execute(ThrowableAction action)
ExecutesThrowableAction
withthe default exception handling
- Parameters:
action
-ThrowableAction
- Throws:
java.lang.NullPointerException
- ifaction
isnull
-
execute
static void execute(ThrowableAction action, java.util.function.Consumer<java.lang.Throwable> exceptionHandler) throws java.lang.NullPointerException
ExecutesThrowableAction
with the customizedexception
handling- Parameters:
action
-ThrowableAction
exceptionHandler
- the handler to handle anyexception
that theexecute()
method throws- Throws:
java.lang.NullPointerException
- ifaction
orexceptionHandler
isnull
-
-