org.springframework.aop.support
public class: Perl5RegexpMethodPointcut [javadoc |
source]
java.lang.Object
org.springframework.aop.support.StaticMethodMatcher
org.springframework.aop.support.StaticMethodMatcherPointcut
org.springframework.aop.support.AbstractRegexpMethodPointcut
org.springframework.aop.support.Perl5RegexpMethodPointcut
All Implemented Interfaces:
Serializable, Pointcut, MethodMatcher
Perl5-style regular expression pointcut. JavaBean properties are:
- pattern: Perl5 regular expression for the fully-qualified method names to match
- 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.
Currently uses the Jakarta ORO
regular expression library. Does not require JDK 1.4+, in contrast to
JdkRegexpMethodPointcut.
| Methods from org.springframework.aop.support.AbstractRegexpMethodPointcut: |
|---|
|
equals, getExcludedPatterns, getPatterns, hashCode, initExcludedPatternRepresentation, initPatternRepresentation, matches, matches, matchesExclusion, matchesPattern, setExcludedPattern, setExcludedPatterns, setPattern, setPatterns, toString |
| Methods from org.springframework.aop.support.StaticMethodMatcher: |
|---|
|
isRuntime, matches |
| Method from org.springframework.aop.support.Perl5RegexpMethodPointcut Detail: |
protected void initPatternRepresentation(String[] patterns) throws IllegalArgumentException {
this.compiledPatterns = new Pattern[patterns.length];
Perl5Compiler compiler = new Perl5Compiler();
for (int i = 0; i < patterns.length; i++) {
// compile the pattern to be thread-safe
try {
this.compiledPatterns[i] = compiler.compile(patterns[i], Perl5Compiler.READ_ONLY_MASK);
}
catch (MalformedPatternException ex) {
throw new IllegalArgumentException(ex.getMessage());
}
}
this.matcher = new Perl5Matcher();
}
Initialize ORO fields from patterns String[]. |
protected boolean matches(String pattern,
int patternIndex) {
boolean matched = this.matcher.matches(pattern, this.compiledPatterns[patternIndex]);
if (logger.isDebugEnabled()) {
logger.debug("Candidate is [" + pattern + "]; pattern is [" +
this.compiledPatterns[patternIndex].getPattern() + "]; matched=" + matched);
}
return matched;
}
|