Package net.bytebuddy.pool
Class TypePool.AbstractBase
- java.lang.Object
-
- net.bytebuddy.pool.TypePool.AbstractBase
-
- All Implemented Interfaces:
TypePool
- Direct Known Subclasses:
TypePool.AbstractBase.Hierarchical,TypePool.LazyFacade
- Enclosing interface:
- TypePool
@Enhance public abstract static class TypePool.AbstractBase extends java.lang.Object implements TypePool
A base implementation of aTypePoolthat is managing a cache provider and that handles the description of array and primitive types.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classTypePool.AbstractBase.ArrayTypeResolutionA resolution for a type that, if resolved, represents an array type.protected static interfaceTypePool.AbstractBase.ComponentTypeReferenceA lazy representation of the component type of an array.static classTypePool.AbstractBase.HierarchicalImplements a hierarchical view of type pools, similarly to class loader hierarchies.-
Nested classes/interfaces inherited from interface net.bytebuddy.pool.TypePool
TypePool.AbstractBase, TypePool.CacheProvider, TypePool.ClassLoading, TypePool.Default, TypePool.Empty, TypePool.Explicit, TypePool.LazyFacade, TypePool.Resolution
-
-
Field Summary
Fields Modifier and Type Field Description protected TypePool.CacheProvidercacheProviderThe cache provider of this instance.protected static java.util.Map<java.lang.String,java.lang.String>PRIMITIVE_DESCRIPTORSA map of primitive types by their descriptor.protected static java.util.Map<java.lang.String,TypeDescription>PRIMITIVE_TYPESA map of primitive types by their name.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractBase(TypePool.CacheProvider cacheProvider)Creates a new instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclear()Clears this type pool's cache.TypePool.Resolutiondescribe(java.lang.String name)Locates and describes the given type by its name.protected TypePool.ResolutiondoCache(java.lang.String name, TypePool.Resolution resolution)Writes the resolution to the cache.protected abstract TypePool.ResolutiondoDescribe(java.lang.String name)Determines a resolution to a non-primitive, non-array type.
-
-
-
Field Detail
-
PRIMITIVE_TYPES
protected static final java.util.Map<java.lang.String,TypeDescription> PRIMITIVE_TYPES
A map of primitive types by their name.
-
PRIMITIVE_DESCRIPTORS
protected static final java.util.Map<java.lang.String,java.lang.String> PRIMITIVE_DESCRIPTORS
A map of primitive types by their descriptor.
-
cacheProvider
protected final TypePool.CacheProvider cacheProvider
The cache provider of this instance.
-
-
Constructor Detail
-
AbstractBase
protected AbstractBase(TypePool.CacheProvider cacheProvider)
Creates a new instance.- Parameters:
cacheProvider- The cache provider to be used.
-
-
Method Detail
-
describe
public TypePool.Resolution describe(java.lang.String name)
Locates and describes the given type by its name.- Specified by:
describein interfaceTypePool- Parameters:
name- The name of the type to describe. The name is to be written as when callingClass.getName().- Returns:
- A resolution of the type to describe. If the type to be described was found, the returned
TypePool.Resolutionrepresents this type. Otherwise, an illegal resolution is returned.
-
doCache
protected TypePool.Resolution doCache(java.lang.String name, TypePool.Resolution resolution)
Writes the resolution to the cache. This method should be overridden if the directly resolved instance should not be added to the cache.- Parameters:
name- The name of the type.resolution- The resolution for this type.- Returns:
- The actual resolution for the type of this name that is stored in the cache.
-
doDescribe
protected abstract TypePool.Resolution doDescribe(java.lang.String name)
Determines a resolution to a non-primitive, non-array type.- Parameters:
name- The name of the type to describe.- Returns:
- A resolution to the type to describe.
-
-