T - The actual matched type of this matcher.public class CachingMatcher<T> extends ElementMatcher.Junction.AbstractBase<T>
| Modifier and Type | Class and Description |
|---|---|
static class |
CachingMatcher.WithInlineEviction<S>
A caching matcher with inline cache eviction.
|
ElementMatcher.Junction.AbstractBase<V>, ElementMatcher.Junction.Conjunction<W>, ElementMatcher.Junction.Disjunction<W>ElementMatcher.Junction<S>| Modifier and Type | Field and Description |
|---|---|
protected ConcurrentMap<? super T,Boolean> |
map
A map that serves as a cache for previous matches.
|
| Constructor and Description |
|---|
CachingMatcher(ElementMatcher<? super T> matcher,
ConcurrentMap<? super T,Boolean> map)
Creates a new caching matcher.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object object) |
int |
hashCode() |
boolean |
matches(T target)
Matches a target against this element matcher.
|
protected boolean |
onCacheMiss(T target)
Invoked if the cache is not hit.
|
String |
toString() |
and, orprotected final ConcurrentMap<? super T,Boolean> map
public CachingMatcher(ElementMatcher<? super T> matcher, ConcurrentMap<? super T,Boolean> map)
matcher - The underlying matcher to apply for non-cached targets.map - A map that serves as a cache for previous matches. This match is strongly referenced and
can cause a memory leak if it is not evicted while keeping this matcher alive.public boolean matches(T target)
ElementMatchertarget - The instance to be matched.true if the given element is matched by this matcher or false otherwise.protected boolean onCacheMiss(T target)
target - The element to be matched.true if the element is matched.Copyright © 2014–2017. All rights reserved.