Perl5 regular expression pointcut bean. JavaBean properties are:
interceptor: AOP Alliance interceptor to invoke if the pointcut matches
Matching is based purely on method name.
Note: the regular expressions must be a match. For example,
.*get.* will match com.mycom.Foo.getBar().
get.* will not.
Currently uses Jakarta ORO regular expression library.
Does not require J2SE 1.4, although it runs under 1.4.
- Author:
- Rod Johnson
- Version: $Id: RegexpMethodPointcut.java,v 1.5 2004/02/11 17:18:17 jhoeller Exp $
- Since: July 22, 2003
| Method Summary |
ClassFilter | getClassFilter() |
String[] | getPatterns() Return the regular expressions for method matching. |
boolean | matches(Method m, Class targetClass) Try to match the regular expression against the fully qualified name
of the method's declaring class, plus the name of the method. |
boolean | matches(Class clazz) |
void | setPattern(String pattern) Convenience method when we have only a single pattern. |
void | setPatterns(String[] patterns) Set the regular expressions defining methods to match. |
getClassFilter
public ClassFilter getClassFilter()
getPatterns
public String[] getPatterns()
- Return the regular expressions for method matching.
matches
public boolean matches(Method m, Class targetClass)
- Try to match the regular expression against the fully qualified name
of the method's declaring class, plus the name of the method.
Note that the declaring class is that class that originally declared
the method, not necessarily the class that's currently exposing it.
For example, java.lang.Object.hashCode matches
any subclass of object's hashCode() method.
matches
public boolean matches(Class clazz)
setPattern
public void setPattern(String pattern)
throws MalformedPatternException
- Convenience method when we have only a single pattern.
Use either this method or setPatterns(), not both.
- See Also:
- setPatterns(java.lang.String[])
setPatterns
public void setPatterns(String[] patterns)
throws MalformedPatternException
- Set the regular expressions defining methods to match.
Matching will be the union of all these; if any match,
the pointcut matches.
- Parameters:
- patterns - Perl5 regular expressions describing methods
to match
to Class java.lang.String- Regular expressions to match