Package net.bytebuddy.matcher
Class CachingMatcher.WithInlineEviction<S>
- java.lang.Object
-
- net.bytebuddy.matcher.ElementMatcher.Junction.AbstractBase<T>
-
- net.bytebuddy.matcher.CachingMatcher<S>
-
- net.bytebuddy.matcher.CachingMatcher.WithInlineEviction<S>
-
- Type Parameters:
S
- The actual matched type of this matcher.
- All Implemented Interfaces:
ElementMatcher<S>
,ElementMatcher.Junction<S>
- Enclosing class:
- CachingMatcher<T>
public static class CachingMatcher.WithInlineEviction<S> extends CachingMatcher<S>
A caching matcher with inline cache eviction.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.bytebuddy.matcher.CachingMatcher
CachingMatcher.WithInlineEviction<S>
-
Nested classes/interfaces inherited from interface net.bytebuddy.matcher.ElementMatcher
ElementMatcher.Junction<S>
-
Nested classes/interfaces inherited from interface net.bytebuddy.matcher.ElementMatcher.Junction
ElementMatcher.Junction.AbstractBase<V>, ElementMatcher.Junction.Conjunction<W>, ElementMatcher.Junction.Disjunction<W>
-
-
Field Summary
Fields Modifier and Type Field Description private int
evictionSize
The maximum amount of entries in this map before removing a random entry from the map.-
Fields inherited from class net.bytebuddy.matcher.CachingMatcher
map
-
-
Constructor Summary
Constructors Constructor Description WithInlineEviction(ElementMatcher<? super S> matcher, java.util.concurrent.ConcurrentMap<? super S,java.lang.Boolean> map, int evictionSize)
Creates a new caching matcher with inlined cache eviction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
onCacheMiss(S target)
Invoked if the cache is not hit.-
Methods inherited from class net.bytebuddy.matcher.CachingMatcher
matches, toString
-
Methods inherited from class net.bytebuddy.matcher.ElementMatcher.Junction.AbstractBase
and, or
-
-
-
-
Constructor Detail
-
WithInlineEviction
public WithInlineEviction(ElementMatcher<? super S> matcher, java.util.concurrent.ConcurrentMap<? super S,java.lang.Boolean> map, int evictionSize)
Creates a new caching matcher with inlined cache eviction.- Parameters:
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.evictionSize
- The maximum amount of entries in this map before removing a random entry from the map.
-
-
Method Detail
-
onCacheMiss
protected boolean onCacheMiss(S target)
Invoked if the cache is not hit.- Overrides:
onCacheMiss
in classCachingMatcher<S>
- Parameters:
target
- The element to be matched.- Returns:
true
if the element is matched.
-
-