org.springframework.aop.Pointcut implementation
that uses the AspectJ weaver to evaluate a pointcut expression.
The pointcut expression value is an AspectJ expression. This can reference other pointcuts and use composition and other operations.
Naturally, as this is to be processed by Spring AOP's proxy-based model, only method execution pointcuts are supported.
| Modifier and Type | Class and Description |
|---|---|
| private class | AspectJExpressionPointcut.BeanContextMatcher
Matcher class for the BeanNamePointcutDesignatorHandler. |
| private class | AspectJExpressionPointcut.BeanPointcutDesignatorHandler
Handler for the Spring-specific |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private BeanFactory | |
| private static final Log | |
| private transient ClassLoader | |
| private Class | |
| private transient PointcutExpression | |
| private String[] | |
| private Class | |
| private transient Map | |
| private static final Set |
| Access | Constructor and Description |
|---|---|
| public | |
| public | AspectJExpressionPointcut(Class<?>
the declaration scope for the pointcut declarationScope, String[] the parameter names for the pointcut paramNames, Class<?>[] the parameter types for the pointcut paramTypes)Create a new AspectJExpressionPointcut with the given settings. |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private PointcutExpression | |
| private boolean | |
| private ClassLoader | |
| public boolean | equals(Object
the reference object with which to compare. other)Overrides java. |
| public ClassFilter | getClassFilter()
Implements org. |
| protected String | |
| private PointcutExpression | getFallbackPointcutExpression(Class<?> targetClass)
Get a new pointcut expression based on a target class's loader rather than the default. |
| public MethodMatcher | getMethodMatcher()
Implements org. |
| public PointcutExpression | |
| private RuntimeTestWalker | |
| private ShadowMatch | |
| private ShadowMatch | |
| public int | |
| private PointcutParser | |
| public boolean | isRuntime()
Implements org. MethodMatcher dynamic, that is, must a final check be made
via the matches(Method, Class, Object[]) method at runtime even
if matches(Method, Class) returns true?
|
| public boolean | matches(Class<?>
the candidate target class targetClass)Implements org. |
| public boolean | matches(Method
the candidate method method, Class<?> the target class targetClass, boolean true if the object on whose behalf we are
asking is the subject on one or more introductions; false otherwiseImplements org. |
| public boolean | matches(Method
the candidate method method, Class<?> the target class targetClass)Implements org. |
| public boolean | matches(Method
the candidate method method, Class<?> the target class targetClass, Object... arguments to the method args)Implements org. |
| private PointcutExpression | obtainPointcutExpression()
Check whether this pointcut is ready to match, lazily building the underlying AspectJ pointcut expression. |
| private void | |
| private String | replaceBooleanOperators(String pcExpr)
If a pointcut expression has been specified in XML, the user cannot
write "and" as "&&" (though |
| private String | |
| public void | setBeanFactory(BeanFactory
owning BeanFactory (never beanFactory)null).
The bean can immediately call methods on the factory.Implements org. |
| public void | |
| public void | |
| public void | setPointcutDeclarationScope(Class<?> pointcutDeclarationScope)
Set the declaration scope for the pointcut. |
| public String |
| beanFactory | back to summary |
|---|---|
| private BeanFactory beanFactory
| |
| logger | back to summary |
|---|---|
| private static final Log logger | |
| pointcutClassLoader | back to summary |
|---|---|
| private transient ClassLoader pointcutClassLoader
| |
| pointcutDeclarationScope | back to summary |
|---|---|
| private Class<?> pointcutDeclarationScope
| |
| pointcutExpression | back to summary |
|---|---|
| private transient PointcutExpression pointcutExpression
| |
| pointcutParameterNames | back to summary |
|---|---|
| private String[] pointcutParameterNames | |
| pointcutParameterTypes | back to summary |
|---|---|
| private Class<?>[] pointcutParameterTypes | |
| shadowMatchCache | back to summary |
|---|---|
| private transient Map<Method, ShadowMatch> shadowMatchCache | |
| SUPPORTED_PRIMITIVES | back to summary |
|---|---|
| private static final Set<PointcutPrimitive> SUPPORTED_PRIMITIVES | |
| AspectJExpressionPointcut | back to summary |
|---|---|
| public AspectJExpressionPointcut() Create a new default AspectJExpressionPointcut. | |
| AspectJExpressionPointcut | back to summary |
|---|---|
| public AspectJExpressionPointcut(Class<?> declarationScope, String[] paramNames, Class<?>[] paramTypes) Create a new AspectJExpressionPointcut with the given settings. | |
| bindParameters | back to summary |
|---|---|
| private void bindParameters(ProxyMethodInvocation invocation, JoinPointMatch jpm) | |
| buildPointcutExpression | back to summary |
|---|---|
| private PointcutExpression buildPointcutExpression(ClassLoader classLoader) Build the underlying AspectJ pointcut expression. | |
| containsAnnotationPointcut | back to summary |
|---|---|
| private boolean containsAnnotationPointcut() | |
| determinePointcutClassLoader | back to summary |
|---|---|
| private ClassLoader determinePointcutClassLoader() Determine the ClassLoader to use for pointcut evaluation.
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
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. | |
| getClassFilter | back to summary |
|---|---|
| public ClassFilter getClassFilter() Implements org. Doc from org. Return the ClassFilter for this pointcut.
| |
| getCurrentProxiedBeanName | back to summary |
|---|---|
protected String getCurrentProxiedBeanName()
| |
| getFallbackPointcutExpression | back to summary |
|---|---|
| private PointcutExpression getFallbackPointcutExpression(Class<?> targetClass) Get a new pointcut expression based on a target class's loader rather than the default.
| |
| getMethodMatcher | back to summary |
|---|---|
| public MethodMatcher getMethodMatcher() Implements org. Doc from org. Return the MethodMatcher for this pointcut.
| |
| getPointcutExpression | back to summary |
|---|---|
| public PointcutExpression getPointcutExpression() Return the underlying AspectJ pointcut expression. | |
| getRuntimeTestWalker | back to summary |
|---|---|
| private RuntimeTestWalker getRuntimeTestWalker(ShadowMatch shadowMatch) | |
| getShadowMatch | back to summary |
|---|---|
| private ShadowMatch getShadowMatch(Method targetMethod, Method originalMethod) | |
| getTargetShadowMatch | back to summary |
|---|---|
| private ShadowMatch getTargetShadowMatch(Method method, Class<?> targetClass) | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| initializePointcutParser | back to summary |
|---|---|
| private PointcutParser initializePointcutParser(ClassLoader classLoader) Initialize the underlying AspectJ pointcut parser. | |
| isRuntime | back to summary |
|---|---|
| public boolean isRuntime() Implements org. Doc from org. Is this Can be invoked when an AOP proxy is created, and need not be invoked again before each method invocation.
| |
| matches | back to summary |
|---|---|
| public boolean matches(Class<?> targetClass) Implements org. Doc from org. Should the pointcut apply to the given interface or target class? | |
| matches | back to summary |
|---|---|
| public boolean matches(Method method, Class<?> targetClass, boolean hasIntroductions) Implements org. Doc from org. Perform static checking whether the given method matches. This may be invoked
instead of the 2-arg | |
| matches | back to summary |
|---|---|
| public boolean matches(Method method, Class<?> targetClass) Implements org. Doc from org. Perform static checking to determine whether the given method matches. If this method returns | |
| matches | back to summary |
|---|---|
| public boolean matches(Method method, Class<?> targetClass, Object... args) Implements org. Doc from org. Check whether there is a runtime (dynamic) match for this method, which must have matched statically. This method is invoked only if Invoked immediately before potential running of the advice, after any advice earlier in the advice chain has run. | |
| obtainPointcutExpression | back to summary |
|---|---|
| private PointcutExpression obtainPointcutExpression() Check whether this pointcut is ready to match, lazily building the underlying AspectJ pointcut expression. | |
| readObject | back to summary |
|---|---|
| private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException | |
| replaceBooleanOperators | back to summary |
|---|---|
| private String replaceBooleanOperators(String pcExpr) If a pointcut expression has been specified in XML, the user cannot
write "and" as "&&" (though We also allow "and" between two pointcut sub-expressions. This method converts back to | |
| resolveExpression | back to summary |
|---|---|
| private String resolveExpression() | |
| setBeanFactory | back to summary |
|---|---|
| public void setBeanFactory(BeanFactory beanFactory) Implements org. Doc from org. Callback that supplies the owning factory to a bean instance. Invoked after the population of normal bean properties
but before an initialization callback such as
| |
| setParameterNames | back to summary |
|---|---|
| public void setParameterNames(String... names) Set the parameter names for the pointcut. | |
| setParameterTypes | back to summary |
|---|---|
| public void setParameterTypes(Class<?>... types) Set the parameter types for the pointcut. | |
| setPointcutDeclarationScope | back to summary |
|---|---|
| public void setPointcutDeclarationScope(Class<?> pointcutDeclarationScope) Set the declaration scope for the pointcut. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
Dynamic match tests for this matcher always return true, since the matching decision is made at the proxy creation time. For static match tests, this matcher abstains to allow the overall pointcut to match even when negation is used with the bean() pointcut.
| Modifier and Type | Field and Description |
|---|---|
| private final NamePattern |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private FuzzyBoolean | |
| public boolean | couldMatchJoinPointsInType(Class<T> someClass)
Implements org.
Deprecated
return true iff this matcher could ever match
a join point in the given type
|
| public boolean | couldMatchJoinPointsInType(Class<T> someClass, MatchingContext context)
Implements org.
Deprecated
return true iff this matcher could ever match
a join point in the given type, may also use any
match context information available
|
| private boolean | |
| public boolean | matchesDynamically(MatchingContext context)
Implements org. |
| public FuzzyBoolean | matchesStatically(MatchingContext context)
Implements org. |
| public boolean | mayNeedDynamicTest()
Implements org. |
| expressionPattern | back to summary |
|---|---|
| private final NamePattern expressionPattern | |
| BeanContextMatcher | back to summary |
|---|---|
| public BeanContextMatcher(String expression) | |
| contextMatch | back to summary |
|---|---|
| private FuzzyBoolean contextMatch(Class<?> targetType) | |
| couldMatchJoinPointsInType | back to summary |
|---|---|
| public boolean couldMatchJoinPointsInType(Class<T> someClass) Implements org. Doc from org. Deprecated
return true iff this matcher could ever match a join point in the given type
| |
| couldMatchJoinPointsInType | back to summary |
|---|---|
| public boolean couldMatchJoinPointsInType(Class<T> someClass, MatchingContext context) Implements org. Doc from org. Deprecated
return true iff this matcher could ever match a join point in the given type, may also use any match context information available
| |
| matchesBean | back to summary |
|---|---|
| private boolean matchesBean(String advisedBeanName) | |
| matchesDynamically | back to summary |
|---|---|
| public boolean matchesDynamically(MatchingContext context) Implements org. Doc from org. Called during processing of ShadowMatch.matchesJoinPoint when matchesStatically returned FuzzyBoolean.MAYBE.
| |
| matchesStatically | back to summary |
|---|---|
| public FuzzyBoolean matchesStatically(MatchingContext context) Implements org. Doc from org. Return FuzzyBoolean.YES if a join point with the given matching context is always matched. Return FuzzyBoolean.NO if a join point with the given matching context is never matched. Return FuzzyBoolean.MAYBE if a match cannot be determined statically (whilst generating a ShadowMatch), and must be determined on a per-join point basis.
| |
| mayNeedDynamicTest | back to summary |
|---|---|
| public boolean mayNeedDynamicTest() Implements org. Doc from org. return true if matchesStatically can ever return FuzzyBoolean.MAYBE (necessitating a per-join point test to determine matching at a given join point).
| |
bean() pointcut designator
extension to AspectJ.
This handler must be added to each pointcut object that needs to
handle the bean() PCD. Matching context is obtained
automatically by examining a thread local variable and therefore a matching
context need not be set on the pointcut.
| Modifier and Type | Field and Description |
|---|---|
| private static final String |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public String | getDesignatorName()
Implements org. |
| public ContextBasedMatcher | parse(String
the body of the pointcut expression.
For example, given the expression "bean(*DAO)" the parse
method will be called with the argument "*DAO". expression)Implements org. |
| BEAN_DESIGNATOR_NAME | back to summary |
|---|---|
| private static final String BEAN_DESIGNATOR_NAME | |
| BeanPointcutDesignatorHandler | back to summary |
|---|---|
| private BeanPointcutDesignatorHandler() | |
| getDesignatorName | back to summary |
|---|---|
| public String getDesignatorName() Implements org. Doc from org. The name of this pointcut designator. For example, if this designator handles a "bean(<NamePattern>) format designator, this method would return "bean".
| |
| parse | back to summary |
|---|---|
| public ContextBasedMatcher parse(String expression) Implements org. Doc from org. Parse the given expression string and return a ContextBasedMatcher that can be used for matching.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final ShadowMatch | |
| private final ShadowMatch |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | alwaysMatches()
Implements org. |
| public JoinPointMatch | matchesJoinPoint(Object
the object bound to this at the join point thisObject, Object the object bound to target at the join point targetObject, Object[] the arguments at the join point args)Implements org. |
| public boolean | maybeMatches()
Implements org. |
| public boolean | neverMatches()
Implements org. |
| public void | setMatchingContext(MatchingContext aMatchContext)
Implements org. |
| other | back to summary |
|---|---|
| private final ShadowMatch other | |
| primary | back to summary |
|---|---|
| private final ShadowMatch primary | |
| DefensiveShadowMatch | back to summary |
|---|---|
| public DefensiveShadowMatch(ShadowMatch primary, ShadowMatch other) | |
| alwaysMatches | back to summary |
|---|---|
| public boolean alwaysMatches() Implements org. Doc from org. True iff the pointcut expression will match any join point at this shadow (for example, any call to the given method).
| |
| matchesJoinPoint | back to summary |
|---|---|
| public JoinPointMatch matchesJoinPoint(Object thisObject, Object targetObject, Object[] args) Implements org. Doc from org. Return the result of matching a join point at this shadow with the given this, target, and args. | |
| maybeMatches | back to summary |
|---|---|
| public boolean maybeMatches() Implements org. Doc from org. True if the pointcut expression may match some join points at this shadow (for example, some calls to the given method may match, depending on the type of the caller). If alwaysMatches is true, then maybeMatches is always true.
| |
| neverMatches | back to summary |
|---|---|
| public boolean neverMatches() Implements org. Doc from org. True iff the pointcut expression can never match any join point at this shadow (for example, the pointcut will never match a call to the given method).
| |
| setMatchingContext | back to summary |
|---|---|
| public void setMatchingContext(MatchingContext aMatchContext) Implements org. Doc from org. Set a matching context to be used when matching join points.
| |