Package org.springframework.aop.support
Class AbstractRegexpMethodPointcut
java.lang.Object
org.springframework.aop.support.StaticMethodMatcher
org.springframework.aop.support.StaticMethodMatcherPointcut
org.springframework.aop.support.AbstractRegexpMethodPointcut
- All Implemented Interfaces:
- Serializable,- MethodMatcher,- Pointcut
- Direct Known Subclasses:
- JdkRegexpMethodPointcut
public abstract class AbstractRegexpMethodPointcut
extends StaticMethodMatcherPointcut
implements Serializable
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(java.lang.String[]) method will be invoked again on deserialization.
- Since:
- 1.1
- Author:
- Rod Johnson, Juergen Hoeller, Rob Harrop
- See Also:
- 
Field SummaryFields inherited from interface org.springframework.aop.MethodMatcherTRUE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleanString[]Returns the regular expressions for exclusion matching.String[]Return the regular expressions for method matching.inthashCode()protected abstract voidinitExcludedPatternRepresentation(String[] patterns) Subclasses must implement this to initialize regexp pointcuts.protected abstract voidinitPatternRepresentation(String[] patterns) Subclasses must implement this to initialize regexp pointcuts.booleanTry 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.protected abstract booleanDoes the pattern at the given index match the given String?protected abstract booleanmatchesExclusion(String pattern, int patternIndex) Does the exclusion pattern at the given index match the given String?protected booleanmatchesPattern(String signatureString) Match the specified candidate against the configured patterns.voidsetExcludedPattern(String excludedPattern) Convenience method when we have only a single exclusion pattern.voidsetExcludedPatterns(String... excludedPatterns) Set the regular expressions defining methods to match for exclusion.voidsetPattern(String pattern) Convenience method when we have only a single pattern.voidsetPatterns(String... patterns) Set the regular expressions defining methods to match.toString()Methods inherited from class org.springframework.aop.support.StaticMethodMatcherPointcutgetClassFilter, getMethodMatcher, setClassFilterMethods inherited from class org.springframework.aop.support.StaticMethodMatcherisRuntime, matches
- 
Constructor Details- 
AbstractRegexpMethodPointcutpublic AbstractRegexpMethodPointcut()
 
- 
- 
Method Details- 
setPatternConvenience method when we have only a single pattern. Use either this method orsetPatterns(java.lang.String...), not both.- See Also:
 
- 
setPatternsSet the regular expressions defining methods to match. Matching will be the union of all these; if any match, the pointcut matches.- See Also:
 
- 
getPatternsReturn the regular expressions for method matching.
- 
setExcludedPatternConvenience method when we have only a single exclusion pattern. Use either this method orsetExcludedPatterns(java.lang.String...), not both.- See Also:
 
- 
setExcludedPatternsSet the regular expressions defining methods to match for exclusion. Matching will be the union of all these; if any match, the pointcut matches.- See Also:
 
- 
getExcludedPatternsReturns the regular expressions for exclusion matching.
- 
matchesTry 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.- Specified by:
- matchesin interface- MethodMatcher
- Parameters:
- method- the candidate method
- targetClass- the target class
- Returns:
- whether this method matches statically
 
- 
matchesPatternMatch 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
 
- 
initPatternRepresentationprotected abstract void initPatternRepresentation(String[] patterns) throws IllegalArgumentException Subclasses must implement this to initialize regexp pointcuts. Can be invoked multiple times.This method will be invoked from the setPatterns(java.lang.String...)method, and also on deserialization.- Parameters:
- patterns- the patterns to initialize
- Throws:
- IllegalArgumentException- in case of an invalid pattern
 
- 
initExcludedPatternRepresentationprotected abstract void initExcludedPatternRepresentation(String[] patterns) throws IllegalArgumentException Subclasses must implement this to initialize regexp pointcuts. Can be invoked multiple times.This method will be invoked from the setExcludedPatterns(java.lang.String...)method, and also on deserialization.- Parameters:
- patterns- the patterns to initialize
- Throws:
- IllegalArgumentException- in case of an invalid pattern
 
- 
matchesDoes the pattern at the given index match the given String?- Parameters:
- pattern- the- Stringpattern to match
- patternIndex- index of pattern (starting from 0)
- Returns:
- trueif there is a match,- falseotherwise
 
- 
matchesExclusionDoes the exclusion pattern at the given index match the given String?- Parameters:
- pattern- the- Stringpattern to match
- patternIndex- index of pattern (starting from 0)
- Returns:
- trueif there is a match,- falseotherwise
 
- 
equals
- 
hashCodepublic int hashCode()
- 
toString
 
-