站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 1.2.9 API 文档英文版

RegexpMethodPointcutAdvisor (Spring Framework) - Spring Framework 1.2.9 API 文档英文版


org.springframework.aop.support
Class RegexpMethodPointcutAdvisor

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

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, like Perl5RegexpMethodPointcut or JdkRegexpMethodPointcut. To choose a specific one, either override the createPointcut() method 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(), Perl5RegexpMethodPointcut, JdkRegexpMethodPointcut, Serialized Form

Field Summary
protected  Log logger
           
 
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)
          Set the regular expression defining methods to match.
 void setPatterns(String[] patterns)
          Set the regular expressions defining methods to match.
 void setPerl5(boolean perl5)
          Set whether to enforce 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
 

Field Detail

logger

protected transient Log logger
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)
Set the regular expression defining methods to match.

Use either this method or setPatterns(java.lang.String[]), not both.

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

setPatterns

public void setPatterns(String[] patterns)
Set the regular expressions defining methods to match. To be passed through to the pointcut implementation.

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

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

setPerl5

public void setPerl5(boolean perl5)
Set whether to enforce Perl5 regexp syntax. Default is "false".

Turn this flag on to use Perl5RegexpMethodPointcut (delegating to Jakarta ORO). Else, JdkRegexpMethodPointcut will be used on JDK 1.4+, falling back to Perl5RegexpMethodPointcut on JDK 1.3.

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.

Returns:
the Pointcut instance (never null)
See Also:
setPerl5(boolean), Perl5RegexpMethodPointcut, JdkRegexpMethodPointcut


Copyright (c) 2002-2007 The Spring Framework Project.