Package com.ultikits.ultitools.aop
Interface ExceptionHandler
public interface ExceptionHandler
Interface for custom exception handlers used with
ExceptionCatch.
Implementations can be registered as beans and referenced by name in the @ExceptionCatch annotation.
- Since:
- 6.2.0
- Author:
- wisdomme
-
Method Summary
Modifier and TypeMethodDescriptiondefault intgetOrder()Gets the order of this handler.handleException(Throwable exception, Object target, Method method, Object[] args) Handles an exception caught during method execution.default booleanDetermines if this handler supports handling the given exception type.
-
Method Details
-
handleException
Object handleException(Throwable exception, Object target, Method method, Object[] args) throws Throwable Handles an exception caught during method execution.- Parameters:
exception- the exception that was caughttarget- the target object whose method threw the exceptionmethod- the method that threw the exceptionargs- the arguments passed to the method- Returns:
- a replacement return value, or null
- Throws:
Throwable- if the handler decides to re-throw the exception
-
supports
Determines if this handler supports handling the given exception type.- Parameters:
exceptionType- the type of exception- Returns:
- true if this handler can handle the exception
-
getOrder
default int getOrder()Gets the order of this handler. Lower values have higher priority.- Returns:
- the handler order
-