The signatures on handler methods on the ThrowsAdvice
implementation method argument must be of the form:
void afterThrowing([Method, args, target], ThrowableSubclass);
Only the last argument is required.
Some examples of valid methods would be:
public void afterThrowing(Exception ex)
public void afterThrowing(RemoteException)
public void afterThrowing(Method method, Object[] args, Object target, Exception ex)
public void afterThrowing(Method method, Object[] args, Object target, ServletException ex)
This is a framework class that need not be used directly by Spring users.
MethodBeforeAdviceInterceptor, AfterReturningAdviceInterceptor
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private final Map | exceptionHandlerMap
Methods on throws advice, keyed by exception class. |
| private static final Log | |
| private final Object |
| Access | Constructor and Description |
|---|---|
| public | ThrowsAdviceInterceptor(Object
the advice object that defines the exception handler methods
(usually a throwsAdvice)org. implementation)Create a new ThrowsAdviceInterceptor for the given ThrowsAdvice. |
| Modifier and Type | Method and Description |
|---|---|
| private Method | Returns: a handler for the given exception type, ornull if none foundthe exception thrown exception)Determine the exception handle method for the given exception. |
| public int | |
| public Object | invoke(MethodInvocation
the method invocation joinpoint mi)Implements org. Implement this method to perform extra treatments before and after the invocation. |
| private void |
| AFTER_THROWING | back to summary |
|---|---|
| private static final String AFTER_THROWING | |
| exceptionHandlerMap | back to summary |
|---|---|
| private final Map<Class<?>, Method> exceptionHandlerMap Methods on throws advice, keyed by exception class. | |
| logger | back to summary |
|---|---|
| private static final Log logger | |
| throwsAdvice | back to summary |
|---|---|
| private final Object throwsAdvice | |
| ThrowsAdviceInterceptor | back to summary |
|---|---|
| public ThrowsAdviceInterceptor(Object throwsAdvice) Create a new ThrowsAdviceInterceptor for the given ThrowsAdvice.
| |
| getExceptionHandler | back to summary |
|---|---|
| private Method getExceptionHandler(Throwable exception) Determine the exception handle method for the given exception. | |
| getHandlerMethodCount | back to summary |
|---|---|
| public int getHandlerMethodCount() Return the number of handler methods in this advice. | |
| invoke | back to summary |
|---|---|
| public Object invoke(MethodInvocation mi) throws Throwable Implements org. Doc from org. Implement this method to perform extra treatments before and
after the invocation. Polite implementations would certainly
like to invoke
| |
| invokeHandlerMethod | back to summary |
|---|---|
| private void invokeHandlerMethod(MethodInvocation mi, Throwable ex, Method method) throws Throwable | |