Package com.webmethods.caf.common
Class SearchTools
java.lang.Object
com.webmethods.caf.common.SearchTools
Utility class for searching through a map based on an input that is either regular or regex.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Pattern
buildPatternForTerm
(String term) Convert the search term to a regex pattern.static Pattern
buildPatternForTerm
(String term, int flags) Convert the search term to a regex pattern.static String
buildRegExForTerm
(String term) Convert the search term to a regex string.buildRegExForTerms
(List<String> terms) Convert the search term list to a list of regex patterns.buildRegExForTerms
(List<String> terms, int flags) Convert the search term list to a list of regex patterns.static boolean
matchesAllRegExPatterns
(String value, List<Pattern> patternList) Check if the given string matches all the regex patterns in the pattern list
-
Field Details
-
regexPatternCache
-
-
Constructor Details
-
SearchTools
public SearchTools()
-
-
Method Details
-
buildRegExForTerms
Convert the search term list to a list of regex patterns. Uses * as wildcard- Parameters:
terms
- list of search terms- Returns:
- list of regex Pattern objects for the given search terms
-
buildRegExForTerms
Convert the search term list to a list of regex patterns. Uses * as wildcard- Parameters:
terms
- list of search termsflags
- flags to use for the pattern object- Returns:
- list of regex Pattern objects for the given search terms
-
buildRegExForTerm
Convert the search term to a regex string. Uses * as wildcard- Parameters:
term
- the search term- Returns:
- regex for the given search term
-
buildPatternForTerm
Convert the search term to a regex pattern. Uses * as wildcard- Parameters:
term
- the search term- Returns:
- regex pattern for the given search term
-
buildPatternForTerm
Convert the search term to a regex pattern. Uses * as wildcard- Parameters:
term
- the search termflags
- flags to use for the pattern object- Returns:
- regex pattern for the given search term
-
matchesAllRegExPatterns
Check if the given string matches all the regex patterns in the pattern list- Parameters:
value
- the string to match againstpatternList
- the list of regex patterns to match- Returns:
- true if the value matches all the patterns, false otherwise
-