public abstract class

AbstractRegexpMethodPointcut

extends StaticMethodMatcherPointcut
implements Serializable
java.lang.Object
   ↳ org.springframework.aop.support.StaticMethodMatcher
     ↳ org.springframework.aop.support.StaticMethodMatcherPointcut
       ↳ org.springframework.aop.support.AbstractRegexpMethodPointcut
Known Direct Subclasses

Class Overview

Abstract base regular expression pointcut bean. JavaBean properties are:

  • pattern: regular expression for the fully-qualified method names to match. The exact regexp syntax will depend on the subclass (e.g. Perl5 regular expressions)
  • patterns: alternative property taking a String array of patterns. The result will be the union of these patterns.

Note: the regular expressions must be a match. For example, .*get.* will match com.mycom.Foo.getBar(). get.* will not.

This base class is serializable. Subclasses should declare all fields transient - the initPatternRepresentation method in this class will be invoked again on the client side on deserialization.

Summary

[Expand]
Inherited Fields
From interface org.springframework.aop.MethodMatcher
From interface org.springframework.aop.Pointcut
Public Constructors
AbstractRegexpMethodPointcut()
Public Methods
boolean equals(Object other)
String[] getExcludedPatterns()
Returns the regular expressions for exclusion matching.
String[] getPatterns()
Return the regular expressions for method matching.
int hashCode()
boolean matches(Method method, Class targetClass)
Try to match the regular expression against the fully qualified name of the target class as well as against the method's declaring class, plus the name of the method.
void setExcludedPattern(String excludedPattern)
Convenience method when we have only a single exclusion pattern.
void setExcludedPatterns(String[] excludedPatterns)
Set the regular expressions defining methods to match for exclusion.
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.
String toString()
Protected Methods
abstract void initExcludedPatternRepresentation(String[] patterns)
Subclasses must implement this to initialize regexp pointcuts.
abstract void initPatternRepresentation(String[] patterns)
Subclasses must implement this to initialize regexp pointcuts.
abstract boolean matches(String pattern, int patternIndex)
Does the pattern at the given index match this string?
abstract boolean matchesExclusion(String pattern, int patternIndex)
Does the exclusion pattern at the given index match this string?
boolean matchesPattern(String signatureString)
Match the specified candidate against the configured patterns.
[Expand]
Inherited Methods
From class org.springframework.aop.support.StaticMethodMatcherPointcut
From class org.springframework.aop.support.StaticMethodMatcher
From class java.lang.Object
From interface org.springframework.aop.MethodMatcher
From interface org.springframework.aop.Pointcut

Public Constructors

public AbstractRegexpMethodPointcut ()

Public Methods

public boolean equals (Object other)

public String[] getExcludedPatterns ()

Returns the regular expressions for exclusion matching.

public String[] getPatterns ()

Return the regular expressions for method matching.

public int hashCode ()

public boolean matches (Method method, Class targetClass)

Try to match the regular expression against the fully qualified name of the target class as well as against the method's declaring class, plus the name of the method.

public void setExcludedPattern (String excludedPattern)

Convenience method when we have only a single exclusion pattern. Use either this method or setExcludedPatterns(String[]), not both.

public void setExcludedPatterns (String[] excludedPatterns)

Set the regular expressions defining methods to match for exclusion. Matching will be the union of all these; if any match, the pointcut matches.

public void setPattern (String pattern)

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

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.

public String toString ()

Protected Methods

protected abstract void initExcludedPatternRepresentation (String[] patterns)

Subclasses must implement this to initialize regexp pointcuts. Can be invoked multiple times.

This method will be invoked from the setExcludedPatterns(String[]) method, and also on deserialization.

Parameters
patterns the patterns to initialize
Throws
IllegalArgumentException in case of an invalid pattern

protected abstract void initPatternRepresentation (String[] patterns)

Subclasses must implement this to initialize regexp pointcuts. Can be invoked multiple times.

This method will be invoked from the setPatterns(String[]) method, and also on deserialization.

Parameters
patterns the patterns to initialize
Throws
IllegalArgumentException in case of an invalid pattern

protected abstract boolean matches (String pattern, int patternIndex)

Does the pattern at the given index match this string?

Parameters
pattern String pattern to match
patternIndex index of pattern from 0
Returns
  • true if there is a match, else false.

protected abstract boolean matchesExclusion (String pattern, int patternIndex)

Does the exclusion pattern at the given index match this string?

Parameters
pattern String pattern to match.
patternIndex index of pattern starting from 0.
Returns
  • true if there is a match, else false.

protected boolean matchesPattern (String signatureString)

Match the specified candidate against the configured patterns.

Parameters
signatureString "java.lang.Object.hashCode" style signature
Returns
  • whether the candidate matches at least one of the specified patterns