Package org.springframework.aop.aspectj

# Class AspectJExpressionPointcut

java.lang.Object
org.springframework.aop.support.AbstractExpressionPointcut
org.springframework.aop.aspectj.AspectJExpressionPointcut

All Implemented Interfaces:
  `Serializable`, `ClassFilter`, `IntroductionAwareMethodMatcher`, `MethodMatcher`, `Pointcut`, `ExpressionPointcut`, `org.springframework.beans.factory.Aware`, `org.springframework.beans.factory.BeanFactoryAware`

public class AspectJExpressionPointcut extends AbstractExpressionPointcut implements ClassFilter, IntroductionAwareMethodMatcher, org.springframework.beans.factory.BeanFactoryAware
Spring `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.

Since:
  2.0
Author:
  Rob Harrop, Adrian Colyer, Rod Johnson, Juergen Hoeller, Ramnivas Laddad, Dave Syer, Yanming Zhou
See Also:
  - Serialized Form

## Field Summary

### Fields inherited from interface org.springframework.aop.ClassFilter

`TRUE`

### Fields inherited from interface org.springframework.aop.MethodMatcher

`TRUE`

### Fields inherited from interface org.springframework.aop.Pointcut

`TRUE`

## Constructor Summary

Constructors
Constructor
Description
`AspectJExpressionPointcut()`
Create a new default AspectJExpressionPointcut.
`AspectJExpressionPointcut(Class<?> declarationScope, String[] paramNames, Class<?>[] paramTypes)`
Create a new AspectJExpressionPointcut with the given settings.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`equals(Object other)`
`ClassFilter`
`getClassFilter()`
Return the ClassFilter for this pointcut.
`protected String`
`getCurrentProxiedBeanName()`
`MethodMatcher`
`getMethodMatcher()`
Return the MethodMatcher for this pointcut.
`org.aspectj.weaver.tools.PointcutExpression`
`getPointcutExpression()`
Return the underlying AspectJ pointcut expression.
`int`
`hashCode()`
`boolean`
`isRuntime()`
Is this `MethodMatcher` dynamic, that is, must a final check be made via the `MethodMatcher.matches(Method, Class, Object[])` method at runtime even if `MethodMatcher.matches(Method, Class)` returns `true`?
`boolean`
`matches(Class<?> targetClass)`
Should the pointcut apply to the given interface or target class?
`boolean`
`matches(Method method, Class<?> targetClass)`
Perform static checking to determine whether the given method matches.
`boolean`
`matches(Method method, Class<?> targetClass, boolean hasIntroductions)`
Perform static checking whether the given method matches.
`boolean`
`matches(Method method, Class<?> targetClass, Object... args)`
Check whether there is a runtime (dynamic) match for this method, which must have matched statically.
`void`
`setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)`
`void`
`setParameterNames(String... names)`
Set the parameter names for the pointcut.
`void`
`setParameterTypes(Class<?>... types)`
Set the parameter types for the pointcut.
`void`
`setPointcutDeclarationScope(Class<?> pointcutDeclarationScope)`
Set the declaration scope for the pointcut.
`String`
`toString()`

### Methods inherited from class org.springframework.aop.support.AbstractExpressionPointcut

`getExpression, getLocation, onSetExpression, setExpression, setLocation`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

## Constructor Details

### AspectJExpressionPointcut

public AspectJExpressionPointcut()
Create a new default AspectJExpressionPointcut.

### AspectJExpressionPointcut

public AspectJExpressionPointcut(Class<?> declarationScope, String[] paramNames, Class<?>[] paramTypes)
Create a new AspectJExpressionPointcut with the given settings.

Parameters:
  `declarationScope` - the declaration scope for the pointcut
  `paramNames` - the parameter names for the pointcut
  `paramTypes` - the parameter types for the pointcut

## Method Details

### setPointcutDeclarationScope

public void setPointcutDeclarationScope(Class<?> pointcutDeclarationScope)
Set the declaration scope for the pointcut.

### setParameterNames

public void setParameterNames(String... names)
Set the parameter names for the pointcut.

### setParameterTypes

public void setParameterTypes(Class<?>... types)
Set the parameter types for the pointcut.

### setBeanFactory

public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)

Specified by:
  `setBeanFactory` in interface `org.springframework.beans.factory.BeanFactoryAware`

### getClassFilter

public ClassFilter getClassFilter()
Description copied from interface: `Pointcut`
Return the ClassFilter for this pointcut.

Specified by:
  `getClassFilter` in interface `Pointcut`
Returns:
  the ClassFilter (never `null`)

### getMethodMatcher

public MethodMatcher getMethodMatcher()
Description copied from interface: `Pointcut`
Return the MethodMatcher for this pointcut.

Specified by:
  `getMethodMatcher` in interface `Pointcut`
Returns:
  the MethodMatcher (never `null`)

### getPointcutExpression

public org.aspectj.weaver.tools.PointcutExpression getPointcutExpression()
Return the underlying AspectJ pointcut expression.

### matches

public boolean matches(Class<?> targetClass)
Description copied from interface: `ClassFilter`
Should the pointcut apply to the given interface or target class?

Specified by:
  `matches` in interface `ClassFilter`
Parameters:
  `targetClass` - the candidate target class
Returns:
  whether the advice should apply to the given target class

### matches

public boolean matches(Method method, Class<?> targetClass, boolean hasIntroductions)
Description copied from interface: `IntroductionAwareMethodMatcher`
Perform static checking whether the given method matches. This may be invoked instead of the 2-arg `MethodMatcher.matches(java.lang.reflect.Method, Class)` method if the caller supports the extended IntroductionAwareMethodMatcher interface.

Specified by:
  `matches` in interface `IntroductionAwareMethodMatcher`
Parameters:
  `method` - the candidate method
  `targetClass` - the target class
  `hasIntroductions` - `true` if the object on whose behalf we are asking is the subject on one or more introductions; `false` otherwise
Returns:
  whether this method matches statically

### matches

public boolean matches(Method method, Class<?> targetClass)
Description copied from interface: `MethodMatcher`
Perform static checking to determine whether the given method matches.

If this method returns `false` or if `MethodMatcher.isRuntime()` returns `false`, no runtime check (i.e. no `MethodMatcher.matches(Method, Class, Object[])` call) will be made.

Specified by:
  `matches` in interface `MethodMatcher`
Parameters:
  `method` - the candidate method
  `targetClass` - the target class
Returns:
  whether this method matches statically

### isRuntime

public boolean isRuntime()
Description copied from interface: `MethodMatcher`
Is this `MethodMatcher` dynamic, that is, must a final check be made via the `MethodMatcher.matches(Method, Class, Object[])` method at runtime even if `MethodMatcher.matches(Method, Class)` returns `true`?

Can be invoked when an AOP proxy is created, and need not be invoked again before each method invocation.

Specified by:
  `isRuntime` in interface `MethodMatcher`
Returns:
  whether a runtime match via `MethodMatcher.matches(Method, Class, Object[])` is required if static matching passed

### matches

public boolean matches(Method method, Class<?> targetClass, Object... args)
Description copied from interface: `MethodMatcher`
Check whether there is a runtime (dynamic) match for this method, which must have matched statically.

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

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

Specified by:
  `matches` in interface `MethodMatcher`
Parameters:
  `method` - the candidate method
  `targetClass` - the target class
  `args` - arguments to the method
Returns:
  whether there's a runtime match
See Also:
  - `MethodMatcher.matches(Method, Class)`

### getCurrentProxiedBeanName

@Nullable protected String getCurrentProxiedBeanName()

### equals

public boolean equals(@Nullable Object other)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### toString

public String toString()

Overrides:
  `toString` in class `Object`