org.springframework.aop.support

Class JdkRegexpMethodPointcut

  • All Implemented Interfaces:
    java.io.Serializable, MethodMatcher, Pointcut


    public class JdkRegexpMethodPointcut
    extends AbstractRegexpMethodPointcut
    Regular expression pointcut based on the java.util.regex package. Supports the following JavaBean properties:
    • pattern: 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.

    Since:
    1.1
    Author:
    Dmitriy Kopylenko, Rob Harrop
    See Also:
    Serialized Form
    • Constructor Detail

      • JdkRegexpMethodPointcut

        public JdkRegexpMethodPointcut()
    • Method Detail

      • initPatternRepresentation

        protected void initPatternRepresentation(java.lang.String[] patterns)
                                          throws java.util.regex.PatternSyntaxException
        Initialize Patterns from the supplied String[].
        Specified by:
        initPatternRepresentation in class AbstractRegexpMethodPointcut
        Parameters:
        patterns - the patterns to initialize
        Throws:
        java.util.regex.PatternSyntaxException
      • initExcludedPatternRepresentation

        protected void initExcludedPatternRepresentation(java.lang.String[] excludedPatterns)
                                                  throws java.util.regex.PatternSyntaxException
        Initialize exclusion Patterns from the supplied String[].
        Specified by:
        initExcludedPatternRepresentation in class AbstractRegexpMethodPointcut
        Parameters:
        excludedPatterns - the patterns to initialize
        Throws:
        java.util.regex.PatternSyntaxException
      • matches

        protected boolean matches(java.lang.String pattern,
                                  int patternIndex)
        Returns true if the Pattern at index patternIndex matches the supplied candidate String.
        Specified by:
        matches in class AbstractRegexpMethodPointcut
        Parameters:
        pattern - the String pattern to match
        patternIndex - index of pattern (starting from 0)
        Returns:
        true if there is a match, false otherwise
      • matchesExclusion

        protected boolean matchesExclusion(java.lang.String candidate,
                                           int patternIndex)
        Returns true if the exclusion Pattern at index patternIndex matches the supplied candidate String.
        Specified by:
        matchesExclusion in class AbstractRegexpMethodPointcut
        Parameters:
        candidate - the String pattern to match
        patternIndex - index of pattern (starting from 0)
        Returns:
        true if there is a match, false otherwise