Interface TypePool.CacheProvider
- All Known Implementing Classes:
TypePool.CacheProvider.Discriminating, TypePool.CacheProvider.NoOp, TypePool.CacheProvider.Simple, TypePool.CacheProvider.Simple.UsingSoftReference, TypePool.CacheProvider.WithIllegalResolutionReattempt
- Enclosing interface:
TypePool
public static interface TypePool.CacheProvider
A cache provider for a
TypePool.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classA discriminating cache provider that delegates a type name to one of two caches.static enumA non-operational cache that does not store any type descriptions.static classA simple, thread-safe type cache based on aConcurrentHashMap.static classA cache provider wrapper that avoids caching illegal resolutions so that future lookups can be reattempted. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TypePool.ResolutionThe value that is returned on a cache-miss. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears this cache.Attempts to find a resolution in this cache.register(String name, TypePool.Resolution resolution) Registers a resolution in this cache.
-
Field Details
-
UNRESOLVED
The value that is returned on a cache-miss.
-
-
Method Details
-
find
Attempts to find a resolution in this cache.- Parameters:
name- The name of the type to describe.- Returns:
- A resolution of the type or
nullif no such resolution can be found in the cache.
-
register
Registers a resolution in this cache. If a resolution to the given name already exists in the cache, it should be discarded.- Parameters:
name- The name of the type that is to be registered.resolution- The resolution to register.- Returns:
- The oldest version of a resolution that is currently registered in the cache which might be the given resolution or another resolution that was previously registered.
-
clear
void clear()Clears this cache.
-