Class PatternsMatcher


  • public class PatternsMatcher
    extends Object
    Helper class that keeps a list of compiled patterns and provides a method to check whether a string matches at least one of them.
    • Field Detail

      • ANY

        public static final PatternsMatcher ANY
        A pattern which patches any string
      • NONE

        public static final PatternsMatcher NONE
        A pattern which matches no string
    • Constructor Detail

      • PatternsMatcher

        public PatternsMatcher​(com.google.common.collect.ImmutableSet<Pattern> compiledPatterns)
    • Method Detail

      • matches

        public boolean matches​(String string)
        Returns:
        true if the given string matches some of the patterns
      • substringMatches

        public boolean substringMatches​(String string)
        Returns:
        true if a substring of the given string matches some of the patterns or there are no patterns
      • isMatchesAny

        public boolean isMatchesAny()
        Returns:
        true if this pattern matches any string
      • isMatchesNone

        public boolean isMatchesNone()
        Returns:
        true if no string matches this pattern
      • filterMatchingMapKeys

        public <V> Map<String,​V> filterMatchingMapKeys​(Map<String,​V> entries)
        Returns:
        a view of the given map where all non-matching keys are removed.