Class PatternHelper

java.lang.Object
org.apache.camel.support.PatternHelper

public final class PatternHelper extends Object
  • Method Details

    • matchPattern

      public static boolean matchPattern(String name, String pattern)
      Matches the name with the given pattern (case insensitive).

      The match rules are applied in this order:

      • exact match, returns true
      • wildcard match (pattern ends with a * and the name starts with the pattern), returns true
      • regular expression match, returns true
      • otherwise returns false
      Parameters:
      name - the name
      pattern - a pattern to match
      Returns:
      true if match, false otherwise.
    • matchPatterns

      public static boolean matchPatterns(String name, String[] patterns)
      Matches the name with the given patterns (case insensitive).
      Parameters:
      name - the name
      patterns - pattern(s) to match
      Returns:
      true if match, false otherwise.
      See Also:
    • matchRegex

      public static boolean matchRegex(String name, String pattern)
      Matches the name with the given pattern (case insensitive).

      The match rules are applied in this order:

      • regular expression match, returns true
      • otherwise returns false
      Parameters:
      name - the name
      pattern - a pattern to match
      Returns:
      true if match, false otherwise.
    • isExcludePatternMatch

      public static boolean isExcludePatternMatch(String key, String... excludePatterns)
    • matchingSet

      public static Set<String> matchingSet(Map<String,Object> map, String pattern, String[] excludePatterns)
      Given a map, creates a set of all keys matching a pattern (except if explicitly excluded). This is usually used to collect matching keys and properties for removal
      Parameters:
      map - A map
      pattern - The pattern to test
      excludePatterns - An exclusion pattern that prevents a matching key to be added to the returned set
      Returns:
      A Set instance with all the matching keys