Package net.bytebuddy.pool
Class TypePool.CacheProvider.Simple
- java.lang.Object
-
- net.bytebuddy.pool.TypePool.CacheProvider.Simple
-
- All Implemented Interfaces:
TypePool.CacheProvider
- Enclosing interface:
- TypePool.CacheProvider
public static class TypePool.CacheProvider.Simple extends java.lang.Object implements TypePool.CacheProvider
A simple, thread-safe type cache based on aConcurrentHashMap
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.pool.TypePool.CacheProvider
TypePool.CacheProvider.NoOp, TypePool.CacheProvider.Simple
-
-
Field Summary
-
Fields inherited from interface net.bytebuddy.pool.TypePool.CacheProvider
UNRESOLVED
-
-
Constructor Summary
Constructors Constructor Description Simple()
Creates a new simple cache.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears this cache.TypePool.Resolution
find(java.lang.String name)
Attempts to find a resolution in this cache.TypePool.Resolution
register(java.lang.String name, TypePool.Resolution resolution)
Registers a resolution in this cache.static TypePool.CacheProvider
withObjectType()
Returns a simple cache provider that is prepopulated with theObject
type.
-
-
-
Method Detail
-
withObjectType
public static TypePool.CacheProvider withObjectType()
Returns a simple cache provider that is prepopulated with theObject
type.- Returns:
- A simple cache provider that is prepopulated with the
Object
type.
-
find
public TypePool.Resolution find(java.lang.String name)
Description copied from interface:TypePool.CacheProvider
Attempts to find a resolution in this cache.- Specified by:
find
in interfaceTypePool.CacheProvider
- Parameters:
name
- The name of the type to describe.- Returns:
- A resolution of the type or
null
if no such resolution can be found in the cache..
-
register
public TypePool.Resolution register(java.lang.String name, TypePool.Resolution resolution)
Description copied from interface:TypePool.CacheProvider
Registers a resolution in this cache. If a resolution to the given name already exists in the cache, it should be discarded.- Specified by:
register
in interfaceTypePool.CacheProvider
- 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
public void clear()
Description copied from interface:TypePool.CacheProvider
Clears this cache.- Specified by:
clear
in interfaceTypePool.CacheProvider
-
-