Top Description Fields Constructors Methods
org.springframework.aop.aspectj

public Class AspectJAfterReturningAdvice

extends AbstractAspectJAdvice
implements AfterReturningAdvice, AfterAdvice, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.springframework.aop.AfterAdvice, org.aopalliance.aop.Advice, org.springframework.aop.AfterReturningAdvice
Annotations
@SuppressWarnings:serial
Imports
java.io.Serializable, java.lang.reflect.Method, .Type, org.springframework.aop.AfterAdvice, .AfterReturningAdvice, org.springframework.lang.Nullable, org.springframework.util.ClassUtils, .TypeUtils

Spring AOP advice wrapping an AspectJ after-returning advice method.
Authors
Rod Johnson, Juergen Hoeller, Ramnivas Laddad
Since
2.0

Field Summary

Inherited from org.springframework.aop.aspectj.AbstractAspectJAdvice:
aspectJAdviceMethodJOIN_POINT_KEY

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
afterReturning(Object
the value returned by the method, if any
returnValue
,
Method
the method being invoked
method
,
Object[]
the arguments to the method
args
,
Object
the target of the method invocation. May be null.
target
)

Implements org.springframework.aop.AfterReturningAdvice.afterReturning.

Callback after a given method successfully returned.
public boolean
public boolean
private boolean

Returns:

whether to invoke the advice method for the given return value and type
matchesReturnValue
(Class<?>
the type of argument declared in advice method
type
,
Method
the advice method
method
,
Object
the return value of the target method
returnValue
)

Following AspectJ semantics, if a return value is null (or return type is void), then the return type of target method should be used to determine whether advice is invoked or not.

public void
private boolean

Returns:

whether to invoke the advice method for the given return value
shouldInvokeOnReturnValueOf
(Method method, Object
the return value of the target method
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.

Inherited from org.springframework.aop.aspectj.AbstractAspectJAdvice:
argBindingbuildSafePointcutcalculateArgumentBindingscreateParameterNameDiscoverercurrentJoinPointgetAspectClassLoadergetAspectInstanceFactorygetAspectJAdviceMethodgetAspectNamegetDeclarationOrdergetDiscoveredReturningGenericTypegetDiscoveredReturningTypegetDiscoveredThrowingTypegetJoinPointgetJoinPointMatchgetJoinPointMatchgetOrdergetPointcutinvokeAdviceMethodinvokeAdviceMethodinvokeAdviceMethodWithGivenArgssetArgumentNamessetArgumentNamesFromStringArraysetAspectNamesetDeclarationOrdersetReturningNameNoChecksetThrowingNamesetThrowingNameNoChecksupportsProceedingJoinPointtoString

Constructor Detail

AspectJAfterReturningAdviceback to summary
public AspectJAfterReturningAdvice(Method aspectJBeforeAdviceMethod, AspectJExpressionPointcut pointcut, AspectInstanceFactory aif)

Method Detail

afterReturningback to summary
public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable

Implements org.springframework.aop.AfterReturningAdvice.afterReturning.

Doc from org.springframework.aop.AfterReturningAdvice.afterReturning.

Callback after a given method successfully returned.

Parameters
returnValue:Object

the value returned by the method, if any

method:Method

the method being invoked

args:Object[]

the arguments to the method

target:Object

the target of the method invocation. May be null.

Annotations
@Override
Exceptions
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.
isAfterAdviceback to summary
public boolean isAfterAdvice()

Implements org.springframework.aop.aspectj.AspectJPrecedenceInformation.isAfterAdvice.

Doc from org.springframework.aop.aspectj.AspectJPrecedenceInformation.isAfterAdvice.

Return whether this is an after advice.

Annotations
@Override
isBeforeAdviceback to summary
public boolean isBeforeAdvice()

Implements org.springframework.aop.aspectj.AspectJPrecedenceInformation.isBeforeAdvice.

Doc from org.springframework.aop.aspectj.AspectJPrecedenceInformation.isBeforeAdvice.

Return whether this is a before advice.

Annotations
@Override
matchesReturnValueback to summary
private boolean matchesReturnValue(Class<?> type, Method method, Object returnValue)

Following AspectJ semantics, if a return value is null (or return type is void), then the return type of target method should be used to determine whether advice is invoked or not. Also, even if the return type is void, if the type of argument declared in the advice method is Object, then the advice must still get invoked.

Parameters
type:Class<?>

the type of argument declared in advice method

method:Method

the advice method

returnValue:Object

the return value of the target method

Returns:boolean

whether to invoke the advice method for the given return value and type

setReturningNameback to summary
public void setReturningName(String name)

Overrides org.springframework.aop.aspectj.AbstractAspectJAdvice.setReturningName.

Annotations
@Override
shouldInvokeOnReturnValueOfback to summary
private boolean shouldInvokeOnReturnValueOf(Method method, 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:Object

the return value of the target method

Returns:boolean

whether to invoke the advice method for the given return value