public class ThrowsAdviceInterceptor extends Object implements MethodInterceptor, AfterAdvice
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
Constructor and Description |
---|
ThrowsAdviceInterceptor(Object throwsAdvice)
Create a new ThrowsAdviceInterceptor for the given ThrowsAdvice.
|
Modifier and Type | Method and Description |
---|---|
int |
getHandlerMethodCount()
Return the number of handler methods in this advice.
|
Object |
invoke(MethodInvocation mi)
Implement this method to perform extra treatments before and
after the invocation.
|
public ThrowsAdviceInterceptor(Object throwsAdvice)
throwsAdvice
- the advice object that defines the exception handler methods
(usually a ThrowsAdvice
implementation)public int getHandlerMethodCount()
@Nullable public Object invoke(MethodInvocation mi) throws Throwable
MethodInterceptor
Joinpoint.proceed()
.invoke
in interface MethodInterceptor
mi
- the method invocation joinpointJoinpoint.proceed()
;
might be intercepted by the interceptorThrowable
- if the interceptors or the target object
throws an exception