Class PatternHelper
java.lang.Object
org.apache.camel.support.PatternHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisExcludePatternMatch(String key, String... excludePatterns) Given a map, creates a set of all keys matching a pattern (except if explicitly excluded).static booleanmatchPattern(String name, String pattern) Matches the name with the given pattern (case insensitive).static booleanmatchPatterns(String name, String[] patterns) Matches the name with the given patterns (case insensitive).static booleanmatchRegex(String name, String pattern) Matches the name with the given pattern (case insensitive).static booleanmatchSimplePattern(String name, String pattern) Matches the name with the given pattern (case insensitive) using simple matching only (no regular expressions).static booleanmatchSimplePatterns(String name, String[] patterns) Matches the name with the given patterns (case insensitive) using simple matching only (no regular expressions).
-
Method Details
-
matchPattern
Matches the name with the given pattern (case insensitive). Only a single pattern is supported, usematchPatterns(String, String[])to match multiple patterns. 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 namepattern- a pattern to match- Returns:
- true if match, false otherwise.
- See Also:
-
matchPatterns
-
matchSimplePattern
Matches the name with the given pattern (case insensitive) using simple matching only (no regular expressions). The match rules are applied in this order:- exact match (case insensitive), returns true
- wildcard match (pattern ends with a * and the name starts with the pattern), returns true
- otherwise returns false
- Parameters:
name- the namepattern- a pattern to match- Returns:
- true if match, false otherwise.
- See Also:
-
matchSimplePatterns
-
matchRegex
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 namepattern- a pattern to match- Returns:
- true if match, false otherwise.
-
isExcludePatternMatch
-
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 mappattern- The pattern to testexcludePatterns- An exclusion pattern that prevents a matching key to be added to the returned set- Returns:
- A
Setinstance with all the matching keys
-