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​(<Pattern> compiledPatterns)
    • Method Detail

      • matches

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

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

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

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

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