org.springframework.aop.support
Class RegexpMethodPointcutAdvisor

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

public class RegexpMethodPointcutAdvisor
extends AbstractPointcutAdvisor

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. To choose a specific one, either override createPointcut or set the "perl5" flag accordingly.

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

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 default pointcut: a Perl5RegexpMethodPointcut.
 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 use Perl5 regexp syntax.
 
Methods inherited from class org.springframework.aop.support.AbstractPointcutAdvisor
equals, getAdvice, getOrder, hashCode, isPerInstance, setAdvice, setOrder, toString
 
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), AbstractPointcutAdvisor.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 match, 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 use Perl5 regexp syntax. If on, Perl5RegexpMethodPointcut will be used (delegating to Jakarta ORO); if off, the JdkRegexpMethodPointcut (delegating to the JDK 1.4 regex package).

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 default pointcut: a Perl5RegexpMethodPointcut.

Alternatively, set the "perl5" flag.

See Also:
setPerl5(boolean), AbstractRegexpMethodPointcut, Perl5RegexpMethodPointcut, JdkRegexpMethodPointcut


Copyright (C) 2003-2004 The Spring Framework Project.