The Spring Framework

org.springframework.aop.support
Class RegexpMethodPointcutAdvisor

java.lang.Object
  extended by org.springframework.aop.support.AbstractPointcutAdvisor
      extended by org.springframework.aop.support.AbstractGenericPointcutAdvisor
          extended by org.springframework.aop.support.RegexpMethodPointcutAdvisor
All Implemented Interfaces:
Serializable, Advisor, PointcutAdvisor, Ordered

public class RegexpMethodPointcutAdvisor
extends AbstractGenericPointcutAdvisor

Convenient class for regexp method pointcuts that hold an Advice, making them an Advisor.

Configure this class using the "pattern" and "patterns" pass-through properties. These are analogous to the pattern and patterns properties of AbstractRegexpMethodPointcut.

Can delegate to any AbstractRegexpMethodPointcut subclass, like Perl5RegexpMethodPointcut or JdkRegexpMethodPointcut. To choose a specific one, either override createPointcut or set the "perl5" flag accordingly.

By default, JdkRegexpMethodPointcut will be used on JDK 1.4+, falling back to Perl5RegexpMethodPointcut on JDK 1.3 (requiring Jakarta ORO on the classpath). The use of Perl5RegexpMethodPointcut can be enforced through specifying the "perl5" property.

Author:
Rod Johnson, Juergen Hoeller
See Also:
setPattern(java.lang.String), setPatterns(java.lang.String[]), setPerl5(boolean), createPointcut(), AbstractRegexpMethodPointcut, Perl5RegexpMethodPointcut, JdkRegexpMethodPointcut, Serialized Form

Field Summary
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
RegexpMethodPointcutAdvisor()
          Create an empty RegexpMethodPointcutAdvisor.
RegexpMethodPointcutAdvisor(Advice advice)
          Create a RegexpMethodPointcutAdvisor for the given advice.
RegexpMethodPointcutAdvisor(String[] patterns, Advice advice)
          Create a RegexpMethodPointcutAdvisor for the given advice.
RegexpMethodPointcutAdvisor(String pattern, Advice advice)
          Create a RegexpMethodPointcutAdvisor for the given advice.
 
Method Summary
protected  AbstractRegexpMethodPointcut createPointcut()
          Create the actual pointcut: by default, a Perl5RegexpMethodPointcut will be created if Perl5 syntax is enforced or when running on JDK 1.3.
 Pointcut getPointcut()
          Initialize the singleton pointcut held within this advisor.
 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.
 void setPerl5(boolean perl5)
          Set whether to enforce Perl5 regexp syntax.
 String toString()
           
 
Methods inherited from class org.springframework.aop.support.AbstractGenericPointcutAdvisor
getAdvice, setAdvice
 
Methods inherited from class org.springframework.aop.support.AbstractPointcutAdvisor
equals, getOrder, hashCode, isPerInstance, setOrder
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RegexpMethodPointcutAdvisor

public RegexpMethodPointcutAdvisor()
Create an empty RegexpMethodPointcutAdvisor.

See Also:
setPattern(java.lang.String), setPatterns(java.lang.String[]), setPerl5(boolean), AbstractGenericPointcutAdvisor.setAdvice(org.aopalliance.aop.Advice)

RegexpMethodPointcutAdvisor

public RegexpMethodPointcutAdvisor(Advice advice)
Create a RegexpMethodPointcutAdvisor for the given advice. The pattern still needs to be specified afterwards.

Parameters:
advice - the advice to use
See Also:
setPattern(java.lang.String), setPatterns(java.lang.String[]), setPerl5(boolean)

RegexpMethodPointcutAdvisor

public RegexpMethodPointcutAdvisor(String pattern,
                                   Advice advice)
Create a RegexpMethodPointcutAdvisor for the given advice.

Parameters:
pattern - the pattern to use
advice - the advice to use
See Also:
setPerl5(boolean)

RegexpMethodPointcutAdvisor

public RegexpMethodPointcutAdvisor(String[] patterns,
                                   Advice advice)
Create a RegexpMethodPointcutAdvisor for the given advice.

Parameters:
patterns - the patterns to use
advice - the advice to use
See Also:
setPerl5(boolean)
Method Detail

setPattern

public void setPattern(String pattern)
Convenience method when we have only a single pattern. Use either this method or setPatterns, not both.

To be passed through to the pointcut implementation.

See Also:
setPatterns(java.lang.String[])

setPatterns

public void setPatterns(String[] patterns)
Set the regular expressions defining methods to match.

Matching will be the union of all these; if any of the patterns matches, the pointcut matches.

To be passed through to the pointcut implementation.

Parameters:
patterns - regular expressions describing methods to match

setPerl5

public void setPerl5(boolean perl5)
Set whether to enforce Perl5 regexp syntax. If on, Perl5RegexpMethodPointcut will be used to use Perl5 syntax (delegating to Jakarta ORO). If off, the JdkRegexpMethodPointcut will be used on JDK 1.4+, falling back to Perl5RegexpMethodPointcut on JDK 1.3. Default is off.

Alternatively, override the createPointcut method.

See Also:
createPointcut(), Perl5RegexpMethodPointcut, JdkRegexpMethodPointcut

getPointcut

public Pointcut getPointcut()
Initialize the singleton pointcut held within this advisor.


createPointcut

protected AbstractRegexpMethodPointcut createPointcut()
Create the actual pointcut: by default, a Perl5RegexpMethodPointcut will be created if Perl5 syntax is enforced or when running on JDK 1.3. Else, a JdkRegexpMethodPointcut (JDK 1.4+) will be used.

See Also:
setPerl5(boolean), Perl5RegexpMethodPointcut, JdkRegexpMethodPointcut

toString

public String toString()
Overrides:
toString in class AbstractGenericPointcutAdvisor

The Spring Framework

Copyright © 2002-2006 The Spring Framework.