@ThreadSafe @Singleton public final class RegExPool extends AbstractNotifyingCache<RegExPattern,Pattern>
Pattern objects.| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_CACHE_SIZE
The default number of items to keep in the cache
|
m_aCacheAccessStats, m_aRWLock, STATISTICS_PREFIX| Modifier and Type | Method and Description |
|---|---|
static RegExPool |
getInstance() |
static Pattern |
getPattern(String sRegEx)
Get the cached regular expression pattern.
|
static Pattern |
getPattern(String sRegEx,
int nOptions)
Get the cached regular expression pattern.
|
protected Pattern |
getValueToCache(RegExPattern aRegEx)
This abstract method is invoked, once a new value needs to be put into the
cache.
|
static boolean |
isInstantiated() |
getFromCacheclearCache, createCache, getFromCacheNoStats, getFromCacheNoStatsNotLocked, getFromCacheNotLocked, getMaxSize, getName, getSize, hasMaxSize, isEmpty, isNotEmpty, putInCache, putInCacheNotLocked, removeFromCache, toStringpublic static final int MAX_CACHE_SIZE
public static boolean isInstantiated()
@Nonnull @IsLocked(value=WRITE) protected Pattern getValueToCache(@Nonnull RegExPattern aRegEx)
AbstractNotifyingCachegetValueToCache in class AbstractNotifyingCache<RegExPattern,Pattern>aRegEx - The key for which the value to cache is required. May be
nullable or not - depends upon the implementation.null.@Nonnull public static Pattern getPattern(@Nonnull @Nonempty @RegEx String sRegEx)
sRegEx - The regular expression to retrieve. May neither be null
nor empty.null
.IllegalArgumentException - If the passed regular expression has an illegal syntax@Nonnull public static Pattern getPattern(@Nonnull @Nonempty @RegEx String sRegEx, @Nonnegative int nOptions)
sRegEx - The regular expression to retrieve. May neither be null
nor empty.nOptions - The options used for Pattern.compilenull
.IllegalArgumentException - If the passed regular expression has an illegal syntaxPattern.compile(String, int)Copyright © 2014–2015 Philip Helger. All rights reserved.