Package org.cdlib.mrt.utility
Class RegexPatternCache
java.lang.Object
org.cdlib.mrt.utility.RegexPatternCache
RegexPatternCache Provides a cache for compiled Regex compiled Patterns
- Author:
- David Loy
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Empty cachegetPattern
(String patternS) look up regular expression pattern in cache - if not found create new pattern, save pattern in cache, and return new compiled patterngetPattern
(String patternS, int flags) look up regular expression pattern in cache - if not found create new pattern, save pattern in cache, and return new compiled pattern
-
Constructor Details
-
RegexPatternCache
public RegexPatternCache()
-
-
Method Details
-
getPattern
look up regular expression pattern in cache - if not found create new pattern, save pattern in cache, and return new compiled pattern- Parameters:
patternS
- string form of pattern to be processed- Returns:
- compiled Regex pattern
-
getPattern
look up regular expression pattern in cache - if not found create new pattern, save pattern in cache, and return new compiled pattern- Parameters:
patternS
- string form of pattern to be processedflags
- flags used for regex compilation- Returns:
- compiled Regex pattern
-
clear
public void clear()Empty cache
-