| Modifier and Type | Class and Description |
|---|---|
| public static class | CachingMatcher.WithInlineEviction<
The actual matched type of this matcher. S>A caching matcher with inline cache eviction. |
| Modifier and Type | Field and Description |
|---|---|
| protected final ConcurrentMap | map
A map that serves as a cache for previous matches. |
| private final ElementMatcher | matcher
The underlying matcher to apply for non-cached targets. |
| private static final Object | NULL_VALUE
A substitute value to store in a map instead of a |
| Access | Constructor and Description |
|---|---|
| public | CachingMatcher(ElementMatcher<? super T>
The underlying matcher to apply for non-cached targets. matcher, ConcurrentMap<? super T, Boolean> 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. map)Creates a new caching matcher. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | matches(T
The instance to be matched or target)null.Implements net. |
| protected boolean | Returns: true if the element is matched.The element to be matched. target)Invoked if the cache is not hit. |
| public String |
| map | back to summary |
|---|---|
| protected final ConcurrentMap<? super T, Boolean> map A map that serves as a cache for previous matches. | |
| matcher | back to summary |
|---|---|
| private final ElementMatcher<? super T> matcher The underlying matcher to apply for non-cached targets. | |
| NULL_VALUE | back to summary |
|---|---|
| private static final Object NULL_VALUE A substitute value to store in a map instead of a | |
| CachingMatcher | back to summary |
|---|---|
| public CachingMatcher(ElementMatcher<? super T> matcher, ConcurrentMap<? super T, Boolean> map) Creates a new caching matcher.
| |
| matches | back to summary |
|---|---|
| public boolean matches(T target) Implements net. Doc from net. Matches a target against this element matcher.
| |
| onCacheMiss | back to summary |
|---|---|
| protected boolean onCacheMiss(T target) Invoked if the cache is not hit.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| Modifier and Type | Field and Description |
|---|---|
| private final int | evictionSize
The maximum amount of entries in this map before removing a random entry from the map. |
| Access | Constructor and Description |
|---|---|
| public | WithInlineEviction(ElementMatcher<? super S>
The underlying matcher to apply for non-cached targets. matcher, ConcurrentMap<? super S, Boolean> 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. map, int The maximum amount of entries in this map before removing a random entry from the map. evictionSize)Creates a new caching matcher with inlined cache eviction. |
| Modifier and Type | Method and Description |
|---|---|
| protected boolean | onCacheMiss(S
The element to be matched. target)
Invoked if the cache is not hit.
|
| evictionSize | back to summary |
|---|---|
| private final int evictionSize The maximum amount of entries in this map before removing a random entry from the map. | |
| WithInlineEviction | back to summary |
|---|---|
| public WithInlineEviction(ElementMatcher<? super S> matcher, ConcurrentMap<? super S, Boolean> map, int evictionSize) Creates a new caching matcher with inlined cache eviction.
| |
| onCacheMiss | back to summary |
|---|---|
| protected boolean onCacheMiss(S target) Overrides net. Doc from net. Invoked if the cache is not hit.
| |