org.springframework.aop.aspectj
Class AspectJAfterReturningAdvice
java.lang.Object
org.springframework.aop.aspectj.AbstractAspectJAdvice
org.springframework.aop.aspectj.AspectJAfterReturningAdvice
- All Implemented Interfaces:
- AfterAdvice, AfterReturningAdvice, AspectJPrecedenceInformation, Ordered
public class AspectJAfterReturningAdvice
- extends AbstractAspectJAdvice
- implements AfterReturningAdvice, AfterAdvice
Spring AOP advice wrapping an AspectJ after-returning advice method.
- Since:
- 2.0
- Author:
- Rod Johnson, Juergen Hoeller, Ramnivas Laddad
Method Summary |
void |
afterReturning(java.lang.Object returnValue,
java.lang.reflect.Method method,
java.lang.Object[] args,
java.lang.Object target)
Callback after a given method successfully returned. |
boolean |
isAfterAdvice()
Return whether this is an after advice. |
boolean |
isBeforeAdvice()
Return whether this is a before advice. |
void |
setReturningName(java.lang.String name)
|
private boolean |
shouldInvokeOnReturnValueOf(java.lang.reflect.Method method,
java.lang.Object returnValue)
Following AspectJ semantics, if a returning clause was specified, then the
advice is only invoked if the returned value is an instance of the given
returning type and generic type parameters, if any, match the assignment
rules. |
Methods inherited from class org.springframework.aop.aspectj.AbstractAspectJAdvice |
argBinding, buildSafePointcut, calculateArgumentBindings, createParameterNameDiscoverer, currentJoinPoint, getAspectClassLoader, getAspectInstanceFactory, getAspectJAdviceMethod, getAspectName, getDeclarationOrder, getDiscoveredReturningGenericType, getDiscoveredReturningType, getDiscoveredThrowingType, getJoinPoint, getJoinPointMatch, getJoinPointMatch, getOrder, getPointcut, invokeAdviceMethod, invokeAdviceMethod, invokeAdviceMethodWithGivenArgs, setArgumentNames, setArgumentNamesFromStringArray, setAspectName, setDeclarationOrder, setReturningNameNoCheck, setThrowingName, setThrowingNameNoCheck, supportsProceedingJoinPoint, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
AspectJAfterReturningAdvice
public AspectJAfterReturningAdvice(java.lang.reflect.Method aspectJBeforeAdviceMethod,
AspectJExpressionPointcut pointcut,
AspectInstanceFactory aif)
isBeforeAdvice
public boolean isBeforeAdvice()
- Description copied from interface:
AspectJPrecedenceInformation
- Return whether this is a before advice.
- Specified by:
isBeforeAdvice
in interface AspectJPrecedenceInformation
isAfterAdvice
public boolean isAfterAdvice()
- Description copied from interface:
AspectJPrecedenceInformation
- Return whether this is an after advice.
- Specified by:
isAfterAdvice
in interface AspectJPrecedenceInformation
setReturningName
public void setReturningName(java.lang.String name)
- Overrides:
setReturningName
in class AbstractAspectJAdvice
afterReturning
public void afterReturning(java.lang.Object returnValue,
java.lang.reflect.Method method,
java.lang.Object[] args,
java.lang.Object target)
throws java.lang.Throwable
- Description copied from interface:
AfterReturningAdvice
- Callback after a given method successfully returned.
- Specified by:
afterReturning
in interface AfterReturningAdvice
- Parameters:
returnValue
- the value returned by the method, if anymethod
- method being invokedargs
- arguments to the methodtarget
- target of the method invocation. May be null
.
- Throws:
java.lang.Throwable
- if this object wishes to abort the call.
Any exception thrown will be returned to the caller if it's
allowed by the method signature. Otherwise the exception
will be wrapped as a runtime exception.
shouldInvokeOnReturnValueOf
private boolean shouldInvokeOnReturnValueOf(java.lang.reflect.Method method,
java.lang.Object returnValue)
- Following AspectJ semantics, if a returning clause was specified, then the
advice is only invoked if the returned value is an instance of the given
returning type and generic type parameters, if any, match the assignment
rules. If the returning type is Object, the advice is *always* invoked.
- Parameters:
returnValue
- the return value of the target method
- Returns:
- whether to invoke the advice method for the given return value