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:
java.io.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. By default, JdkRegexpMethodPointcut will be used. To choose a specific one, override the createPointcut() method.

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

Nested Class Summary
private static class RegexpMethodPointcutAdvisor.SerializableMonitor
          Empty class used for a serializable monitor object.
 
Field Summary
private  java.lang.String[] patterns
           
private  AbstractRegexpMethodPointcut pointcut
           
private  java.lang.Object pointcutMonitor
           
 
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(java.lang.String[] patterns, Advice advice)
          Create a RegexpMethodPointcutAdvisor for the given advice.
RegexpMethodPointcutAdvisor(java.lang.String pattern, Advice advice)
          Create a RegexpMethodPointcutAdvisor for the given advice.
 
Method Summary
protected  AbstractRegexpMethodPointcut createPointcut()
          Create the actual pointcut: By default, a JdkRegexpMethodPointcut will be used.
 Pointcut getPointcut()
          Initialize the singleton Pointcut held within this Advisor.
 void setPattern(java.lang.String pattern)
          Set the regular expression defining methods to match.
 void setPatterns(java.lang.String[] patterns)
          Set the regular expressions defining methods to match.
 java.lang.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
 

Field Detail

patterns

private java.lang.String[] patterns

pointcut

private AbstractRegexpMethodPointcut pointcut

pointcutMonitor

private final java.lang.Object pointcutMonitor
Constructor Detail

RegexpMethodPointcutAdvisor

public RegexpMethodPointcutAdvisor()
Create an empty RegexpMethodPointcutAdvisor.

See Also:
setPattern(java.lang.String), setPatterns(java.lang.String[]), AbstractGenericPointcutAdvisor.setAdvice(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[])

RegexpMethodPointcutAdvisor

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

Parameters:
pattern - the pattern to use
advice - the advice to use

RegexpMethodPointcutAdvisor

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

Parameters:
patterns - the patterns to use
advice - the advice to use
Method Detail

setPattern

public void setPattern(java.lang.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(java.lang.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[])

getPointcut

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


createPointcut

protected AbstractRegexpMethodPointcut createPointcut()
Create the actual pointcut: By default, a JdkRegexpMethodPointcut will be used.

Returns:
the Pointcut instance (never null)

toString

public java.lang.String toString()
Overrides:
toString in class AbstractGenericPointcutAdvisor