org.springframework.aop.support
Class RegexpMethodPointcut

org.springframework.aop.support.StaticMethodMatcher
  |
  +--org.springframework.aop.support.StaticMethodMatcherPointcut
        |
        +--org.springframework.aop.support.RegexpMethodPointcut
Direct Known Subclasses:
RegexpMethodPointcutAroundAdvisor

public class RegexpMethodPointcut
extends StaticMethodMatcherPointcut
implements ClassFilter

Perl5 regular expression pointcut bean. JavaBean properties are:

  • pattern: Perl5 regular expression for the fully-qualified method names to match
  • patterns: alternative property taking a String array of patterns. The result will be the union of these patterns.
  • 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
     ClassFiltergetClassFilter()
               
     String[]getPatterns()
              Return the regular expressions for method matching.
     booleanmatches(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.
     booleanmatches(Class clazz)
               
     voidsetPattern(String pattern)
              Convenience method when we have only a single pattern.
     voidsetPatterns(String[] patterns)
              Set the regular expressions defining methods to match.

    Methods inherited from class org.springframework.aop.support.StaticMethodMatcherPointcut
    getMethodMatcher

    Methods inherited from class org.springframework.aop.support.StaticMethodMatcher
    isRuntime, matches

    Method Detail

    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

    Association Links

    to Class java.lang.String

    Regular expressions to match