public static class TypePool.CacheProvider.Simple extends java.lang.Object implements TypePool.CacheProvider
ConcurrentHashMap
.TypePool.CacheProvider.NoOp, TypePool.CacheProvider.Simple
Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.ConcurrentMap<java.lang.String,TypePool.Resolution> |
storage
A map containing all cached resolutions by their names.
|
UNRESOLVED
Constructor and Description |
---|
Simple()
Creates a new simple cache.
|
Simple(java.util.concurrent.ConcurrentMap<java.lang.String,TypePool.Resolution> storage)
Creates a new simple cache.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears this cache.
|
TypePool.Resolution |
find(java.lang.String name)
Attempts to find a resolution in this cache.
|
java.util.concurrent.ConcurrentMap<java.lang.String,TypePool.Resolution> |
getStorage()
Returns the underlying storage map of this simple cache provider.
|
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 the
Object type. |
private final java.util.concurrent.ConcurrentMap<java.lang.String,TypePool.Resolution> storage
public Simple()
public Simple(java.util.concurrent.ConcurrentMap<java.lang.String,TypePool.Resolution> storage)
storage
- A map that is used for locating and storing resolutions.public static TypePool.CacheProvider withObjectType()
Object
type.Object
type.public TypePool.Resolution find(java.lang.String name)
find
in interface TypePool.CacheProvider
name
- The name of the type to describe.null
if no such resolution can be found in the cache..public TypePool.Resolution register(java.lang.String name, TypePool.Resolution resolution)
register
in interface TypePool.CacheProvider
name
- The name of the type that is to be registered.resolution
- The resolution to register.public void clear()
clear
in interface TypePool.CacheProvider
public java.util.concurrent.ConcurrentMap<java.lang.String,TypePool.Resolution> getStorage()