public abstract class AbstractRegexpMethodPointcut extends StaticMethodMatcherPointcut implements Serializable
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.
JdkRegexpMethodPointcut
,
Serialized FormTRUE
Constructor and Description |
---|
AbstractRegexpMethodPointcut() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
String[] |
getExcludedPatterns()
Returns the regular expressions for exclusion matching.
|
String[] |
getPatterns()
Return the regular expressions for method matching.
|
int |
hashCode() |
protected abstract void |
initExcludedPatternRepresentation(String[] patterns)
Subclasses must implement this to initialize regexp pointcuts.
|
protected abstract void |
initPatternRepresentation(String[] patterns)
Subclasses must implement this to initialize regexp pointcuts.
|
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.
|
protected abstract boolean |
matches(String pattern,
int patternIndex)
Does the pattern at the given index match this string?
|
protected abstract boolean |
matchesExclusion(String pattern,
int patternIndex)
Does the exclusion pattern at the given index match this string?
|
protected boolean |
matchesPattern(String signatureString)
Match the specified candidate against the configured patterns.
|
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() |
getClassFilter, getMethodMatcher, setClassFilter
isRuntime, matches
public void setPattern(String pattern)
setPatterns(java.lang.String[])
, not both.setPatterns(java.lang.String[])
public void setPatterns(String[] patterns)
public String[] getPatterns()
public void setExcludedPattern(String excludedPattern)
setExcludedPatterns(java.lang.String[])
, not both.setExcludedPatterns(java.lang.String[])
public void setExcludedPatterns(String[] excludedPatterns)
public String[] getExcludedPatterns()
public boolean matches(Method method, Class<?> targetClass)
matches
in interface MethodMatcher
method
- the candidate methodtargetClass
- the target class (may be null
, in which case
the candidate class must be taken to be the method's declaring class)protected boolean matchesPattern(String signatureString)
signatureString
- "java.lang.Object.hashCode" style signatureprotected abstract void initPatternRepresentation(String[] patterns) throws IllegalArgumentException
This method will be invoked from the setPatterns(java.lang.String[])
method,
and also on deserialization.
patterns
- the patterns to initializeIllegalArgumentException
- in case of an invalid patternprotected abstract void initExcludedPatternRepresentation(String[] patterns) throws IllegalArgumentException
This method will be invoked from the setExcludedPatterns(java.lang.String[])
method,
and also on deserialization.
patterns
- the patterns to initializeIllegalArgumentException
- in case of an invalid patternprotected abstract boolean matches(String pattern, int patternIndex)
pattern
- String
pattern to matchpatternIndex
- index of pattern from 0true
if there is a match, else false
.protected abstract boolean matchesExclusion(String pattern, int patternIndex)
pattern
- String
pattern to match.patternIndex
- index of pattern starting from 0.true
if there is a match, else false
.