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