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

pack-priv final Class InstantiationModelAwarePointcutAdvisorImpl

extends Object
implements InstantiationModelAwarePointcutAdvisor, AspectJPrecedenceInformation, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.springframework.aop.aspectj.AspectJPrecedenceInformation, org.springframework.core.Ordered, org.springframework.aop.aspectj.InstantiationModelAwarePointcutAdvisor, org.springframework.aop.PointcutAdvisor, org.springframework.aop.Advisor
Annotations
@SuppressWarnings:serial
Imports
java.io.IOException, .ObjectInputStream, .Serializable, java.lang.reflect.Method, org.aopalliance.aop.Advice, org.aspectj.lang.reflect.PerClauseKind, org.springframework.aop.Pointcut, org.springframework.aop.aspectj.AspectJExpressionPointcut, .AspectJPrecedenceInformation, .InstantiationModelAwarePointcutAdvisor, org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactory.AspectJAnnotation, org.springframework.aop.support.DynamicMethodMatcherPointcut, .Pointcuts, org.springframework.lang.Nullable, org.springframework.util.ObjectUtils

Internal implementation of AspectJPointcutAdvisor.

Note that there will be one instance of this advisor for each target method.

Authors
Rod Johnson, Juergen Hoeller, Sam Brannen
Since
2.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
InstantiationModelAwarePointcutAdvisorImpl.PerTargetInstantiationModelPointcut

Pointcut implementation that changes its behaviour when the advice is instantiated.

Field Summary

Modifier and TypeField and Description
private final MetadataAwareAspectInstanceFactory
private transient Method
private final AspectJAdvisorFactory
private final String
private final int
private final AspectJExpressionPointcut
private final Class<?>
private static final Advice
private Advice
private Boolean
private Boolean
private final boolean
private final String
private final Class<?>[]
private final Pointcut

Constructor Summary

AccessConstructor and Description
public
InstantiationModelAwarePointcutAdvisorImpl(AspectJExpressionPointcut declaredPointcut, Method aspectJAdviceMethod, AspectJAdvisorFactory aspectJAdvisorFactory, MetadataAwareAspectInstanceFactory aspectInstanceFactory, int declarationOrder, String aspectName)

Method Summary

Modifier and TypeMethod and Description
private void
determineAdviceType()

Duplicates some logic from getAdvice, but importantly does not force creation of the advice.

public synchronized Advice
getAdvice()

Implements org.springframework.aop.Advisor.getAdvice.

Lazily instantiate advice if necessary.
public MetadataAwareAspectInstanceFactory
public AspectMetadata
getAspectMetadata()

Return the AspectJ AspectMetadata for this advisor.

public String
getAspectName()

Implements org.springframework.aop.aspectj.AspectJPrecedenceInformation.getAspectName.

Return the name of the aspect (bean) in which the advice was declared.
public int
getDeclarationOrder()

Implements org.springframework.aop.aspectj.AspectJPrecedenceInformation.getDeclarationOrder.

Return the declaration order of the advice member within the aspect.
public AspectJExpressionPointcut
public int
getOrder()

Implements org.springframework.core.Ordered.getOrder.

Get the order value of this object.
public Pointcut
getPointcut()

Implements org.springframework.aop.PointcutAdvisor.getPointcut.

The pointcut for Spring AOP to use.
private Advice
public synchronized boolean
isAdviceInstantiated()

Implements org.springframework.aop.aspectj.InstantiationModelAwarePointcutAdvisor.isAdviceInstantiated.

Return whether this advisor has already instantiated its advice.
public boolean
public boolean
public boolean
isLazy()

Implements org.springframework.aop.aspectj.InstantiationModelAwarePointcutAdvisor.isLazy.

Return whether this advisor is lazily initializing its underlying advice.
public boolean
isPerInstance()

Overrides default org.springframework.aop.Advisor.isPerInstance.

This is only of interest for Spring AOP: AspectJ instantiation semantics are much richer.
private void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

aspectInstanceFactoryback to summary
private final MetadataAwareAspectInstanceFactory aspectInstanceFactory
aspectJAdviceMethodback to summary
private transient Method aspectJAdviceMethod
aspectJAdvisorFactoryback to summary
private final AspectJAdvisorFactory aspectJAdvisorFactory
aspectNameback to summary
private final String aspectName
declarationOrderback to summary
private final int declarationOrder
declaredPointcutback to summary
private final AspectJExpressionPointcut declaredPointcut
declaringClassback to summary
private final Class<?> declaringClass
EMPTY_ADVICEback to summary
private static final Advice EMPTY_ADVICE

Hides org.springframework.aop.Advisor.EMPTY_ADVICE.

instantiatedAdviceback to summary
private Advice instantiatedAdvice
Annotations
@Nullable
isAfterAdviceback to summary
private Boolean isAfterAdvice
Annotations
@Nullable
isBeforeAdviceback to summary
private Boolean isBeforeAdvice
Annotations
@Nullable
lazyback to summary
private final boolean lazy
methodNameback to summary
private final String methodName
parameterTypesback to summary
private final Class<?>[] parameterTypes
pointcutback to summary
private final Pointcut pointcut

Constructor Detail

InstantiationModelAwarePointcutAdvisorImplback to summary
public InstantiationModelAwarePointcutAdvisorImpl(AspectJExpressionPointcut declaredPointcut, Method aspectJAdviceMethod, AspectJAdvisorFactory aspectJAdvisorFactory, MetadataAwareAspectInstanceFactory aspectInstanceFactory, int declarationOrder, String aspectName)

Method Detail

determineAdviceTypeback to summary
private void determineAdviceType()

Duplicates some logic from getAdvice, but importantly does not force creation of the advice.

getAdviceback to summary
public synchronized Advice getAdvice()

Implements org.springframework.aop.Advisor.getAdvice.

Lazily instantiate advice if necessary.

Returns:Advice

Doc from org.springframework.aop.Advisor.getAdvice.

the advice that should apply if the pointcut matches

Annotations
@Override
getAspectInstanceFactoryback to summary
public MetadataAwareAspectInstanceFactory getAspectInstanceFactory()
getAspectMetadataback to summary
public AspectMetadata getAspectMetadata()

Return the AspectJ AspectMetadata for this advisor.

getAspectNameback to summary
public String getAspectName()

Implements org.springframework.aop.aspectj.AspectJPrecedenceInformation.getAspectName.

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

Return the name of the aspect (bean) in which the advice was declared.

Annotations
@Override
getDeclarationOrderback to summary
public int getDeclarationOrder()

Implements org.springframework.aop.aspectj.AspectJPrecedenceInformation.getDeclarationOrder.

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

Return the declaration order of the advice member within the aspect.

Annotations
@Override
getDeclaredPointcutback to summary
public AspectJExpressionPointcut getDeclaredPointcut()
getOrderback to summary
public int getOrder()

Implements org.springframework.core.Ordered.getOrder.

Doc from org.springframework.core.Ordered.getOrder.

Get the order value of this object.

Higher values are interpreted as lower priority. As a consequence, the object with the lowest value has the highest priority (somewhat analogous to Servlet load-on-startup values).

Same order values will result in arbitrary sort positions for the affected objects.

Returns:int

the order value

Annotations
@Override
getPointcutback to summary
public Pointcut getPointcut()

Implements org.springframework.aop.PointcutAdvisor.getPointcut.

The pointcut for Spring AOP to use. Actual behaviour of the pointcut will change depending on the state of the advice.

Annotations
@Override
instantiateAdviceback to summary
private Advice instantiateAdvice(AspectJExpressionPointcut pointcut)
isAdviceInstantiatedback to summary
public synchronized boolean isAdviceInstantiated()

Implements org.springframework.aop.aspectj.InstantiationModelAwarePointcutAdvisor.isAdviceInstantiated.

Doc from org.springframework.aop.aspectj.InstantiationModelAwarePointcutAdvisor.isAdviceInstantiated.

Return whether this advisor has already instantiated its advice.

Annotations
@Override
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
isLazyback to summary
public boolean isLazy()

Implements org.springframework.aop.aspectj.InstantiationModelAwarePointcutAdvisor.isLazy.

Doc from org.springframework.aop.aspectj.InstantiationModelAwarePointcutAdvisor.isLazy.

Return whether this advisor is lazily initializing its underlying advice.

Annotations
@Override
isPerInstanceback to summary
public boolean isPerInstance()

Overrides default org.springframework.aop.Advisor.isPerInstance.

This is only of interest for Spring AOP: AspectJ instantiation semantics are much richer. In AspectJ terminology, all a return of true means here is that the aspect is not a SINGLETON.

Returns:boolean

Doc from org.springframework.aop.Advisor.isPerInstance.

whether this advice is associated with a particular target instance

Annotations
@Override
readObjectback to summary
private void readObject(ObjectInputStream inputStream) throws IOException, ClassNotFoundException
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
org.springframework.aop.aspectj.annotation back to summary

private final Class InstantiationModelAwarePointcutAdvisorImpl.PerTargetInstantiationModelPointcut

extends DynamicMethodMatcherPointcut
Class Inheritance

Pointcut implementation that changes its behaviour when the advice is instantiated. Note that this is a dynamic pointcut; otherwise it might be optimized out if it does not at first match statically.

Field Summary

Modifier and TypeField and Description
private LazySingletonAspectInstanceFactoryDecorator
private final AspectJExpressionPointcut
private final Pointcut

Constructor Summary

AccessConstructor and Description
public
PerTargetInstantiationModelPointcut(AspectJExpressionPointcut declaredPointcut, Pointcut preInstantiationPointcut, MetadataAwareAspectInstanceFactory aspectInstanceFactory)

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
other
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
private boolean
public boolean
matches(Method
the candidate method
method
,
Class<?>
the target class
targetClass
)

Overrides org.springframework.aop.support.DynamicMethodMatcher.matches.

Implements org.springframework.aop.MethodMatcher.matches.

Can override to add preconditions for dynamic matching.
public boolean
matches(Method
the candidate method
method
,
Class<?>
the target class
targetClass
,
Object...
arguments to the method
args
)

Implements org.springframework.aop.MethodMatcher.matches.

Check whether there is a runtime (dynamic) match for this method, which must have matched statically.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from org.springframework.aop.support.DynamicMethodMatcherPointcut:
getClassFiltergetMethodMatcher

Field Detail

aspectInstanceFactoryback to summary
private LazySingletonAspectInstanceFactoryDecorator aspectInstanceFactory
Annotations
@Nullable
declaredPointcutback to summary
private final AspectJExpressionPointcut declaredPointcut
preInstantiationPointcutback to summary
private final Pointcut preInstantiationPointcut

Constructor Detail

PerTargetInstantiationModelPointcutback to summary
public PerTargetInstantiationModelPointcut(AspectJExpressionPointcut declaredPointcut, Pointcut preInstantiationPointcut, MetadataAwareAspectInstanceFactory aspectInstanceFactory)

Method Detail

equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
other:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
isAspectMaterializedback to summary
private boolean isAspectMaterialized()
matchesback to summary
public boolean matches(Method method, Class<?> targetClass)

Overrides org.springframework.aop.support.DynamicMethodMatcher.matches.

Implements org.springframework.aop.MethodMatcher.matches.

Doc from org.springframework.aop.support.DynamicMethodMatcher.matches.

Can override to add preconditions for dynamic matching. This implementation always returns true.

Parameters
method:Method

Doc from org.springframework.aop.MethodMatcher.matches.

the candidate method

targetClass:Class<?>

Doc from org.springframework.aop.MethodMatcher.matches.

the target class

Returns:boolean

Doc from org.springframework.aop.MethodMatcher.matches.

whether this method matches statically

Annotations
@Override
matchesback to summary
public boolean matches(Method method, Class<?> targetClass, Object... args)

Implements org.springframework.aop.MethodMatcher.matches.

Doc from org.springframework.aop.MethodMatcher.matches.

Check whether there is a runtime (dynamic) match for this method, which must have matched statically.

This method is invoked only if matches(Method, Class) returns true for the given method and target class, and if isRuntime() returns true.

Invoked immediately before potential running of the advice, after any advice earlier in the advice chain has run.

Parameters
method:Method

the candidate method

targetClass:Class<?>

the target class

args:Object[]

arguments to the method

Returns:boolean

whether there's a runtime match

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override