Package org.springframework.aop.aspectj
Class TypePatternClassFilter
- java.lang.Object
- org.springframework.aop.aspectj.TypePatternClassFilter
- All Implemented Interfaces:
ClassFilter
public class TypePatternClassFilter extends Object implements ClassFilter
Spring AOPClassFilter
implementation using AspectJ type matching.- Since:
- 2.0
- Author:
- Rod Johnson, Juergen Hoeller
Field Summary
Fields inherited from interface org.springframework.aop.ClassFilter
TRUE
Constructor Summary
Constructors Constructor Description TypePatternClassFilter()
Creates a new instance of theTypePatternClassFilter
class.TypePatternClassFilter(String typePattern)
Create a fully configuredTypePatternClassFilter
using the given type pattern.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getTypePattern()
Return the AspectJ type pattern to match.boolean
matches(Class<?> clazz)
Should the pointcut apply to the given interface or target class?void
setTypePattern(String typePattern)
Set the AspectJ type pattern to match.
Constructor Detail
TypePatternClassFilter
public TypePatternClassFilter()
Creates a new instance of theTypePatternClassFilter
class.This is the JavaBean constructor; be sure to set the
typePattern
property, else a no doubt fatalIllegalStateException
will be thrown when thematches(Class)
method is first invoked.
TypePatternClassFilter
public TypePatternClassFilter(String typePattern)
Create a fully configuredTypePatternClassFilter
using the given type pattern.- Parameters:
typePattern
- the type pattern that AspectJ weaver should parse- Throws:
IllegalArgumentException
- if the suppliedtypePattern
isnull
or is recognized as invalid
Method Detail
setTypePattern
public void setTypePattern(String typePattern)
Set the AspectJ type pattern to match.Examples include:
org.springframework.beans.*
This will match any class or interface in the given package.org.springframework.beans.ITestBean+
This will match theITestBean
interface and any class that implements it.These conventions are established by AspectJ, not Spring AOP.
- Parameters:
typePattern
- the type pattern that AspectJ weaver should parse- Throws:
IllegalArgumentException
- if the suppliedtypePattern
isnull
or is recognized as invalid
getTypePattern
public String getTypePattern()
Return the AspectJ type pattern to match.
matches
public boolean matches(Class<?> clazz)
Should the pointcut apply to the given interface or target class?- Specified by:
matches
in interfaceClassFilter
- Parameters:
clazz
- candidate target class- Returns:
- whether the advice should apply to this candidate target class
- Throws:
IllegalStateException
- if nosetTypePattern(String)
has been set