Package net.bytebuddy.pool
Class TypePool.Default
- java.lang.Object
-
- net.bytebuddy.pool.TypePool.AbstractBase
-
- net.bytebuddy.pool.TypePool.AbstractBase.Hierarchical
-
- net.bytebuddy.pool.TypePool.Default
-
- All Implemented Interfaces:
TypePool
- Direct Known Subclasses:
TypePool.Default.WithLazyResolution
- Enclosing interface:
- TypePool
@Enhance public static class TypePool.Default extends TypePool.AbstractBase.Hierarchical
A default implementation of a
TypePoolthat models binary data in the Java byte code format into aTypeDescription. The data lookup is delegated to aClassFileLocator.TypePool.Resolutions that are produced by this type pool are either fully resolved or not resolved at all.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interfaceTypePool.Default.AnnotationRegistrantAn annotation registrant implements a visitor pattern for reading an unknown amount of values of annotations.protected static interfaceTypePool.Default.ComponentTypeLocatorA component type locator allows for the lazy location of an array's component type.protected static classTypePool.Default.GenericTypeExtractorA generic type extractor allows for an iterative extraction of generic type information.protected static interfaceTypePool.Default.GenericTypeRegistrantA type registrant allows to register a generic type token.protected static classTypePool.Default.LazyTypeDescriptionA type description that looks up any referencedByteCodeElementorAnnotationDescriptionby querying a type pool at lookup time.protected static classTypePool.Default.ParameterBagA bag for collecting parameter meta information that is stored as debug information for implemented methods.static classTypePool.Default.ReaderModeDetermines the granularity of the class file parsing that is conducted by aTypePool.Default.protected classTypePool.Default.TypeExtractorA type extractor reads a class file and collects data that is relevant to create a type description.static classTypePool.Default.WithLazyResolutionA variant ofTypePool.Defaultthat resolves type descriptions lazily.-
Nested classes/interfaces inherited from class net.bytebuddy.pool.TypePool.AbstractBase
TypePool.AbstractBase.ArrayTypeResolution, TypePool.AbstractBase.ComponentTypeReference, TypePool.AbstractBase.Hierarchical
-
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 ClassFileLocatorclassFileLocatorThe locator to query for finding binary data of a type.protected AsmClassReader.FactoryclassReaderFactoryThe class reader factory to use.private static org.objectweb.asm.MethodVisitorIGNORE_METHODIndicates that a visited method should be ignored.protected TypePool.Default.ReaderModereaderModeThe reader mode to apply by this default type pool.-
Fields inherited from class net.bytebuddy.pool.TypePool.AbstractBase
cacheProvider, PRIMITIVE_DESCRIPTORS, PRIMITIVE_TYPES
-
-
Constructor Summary
Constructors Constructor Description Default(TypePool.CacheProvider cacheProvider, ClassFileLocator classFileLocator, TypePool.Default.ReaderMode readerMode)Creates a new default type pool without a parent pool.Default(TypePool.CacheProvider cacheProvider, ClassFileLocator classFileLocator, TypePool.Default.ReaderMode readerMode, TypePool parentPool)Creates a new default type pool.Default(TypePool.CacheProvider cacheProvider, ClassFileLocator classFileLocator, TypePool.Default.ReaderMode readerMode, AsmClassReader.Factory classReaderFactory)Creates a new default type pool that uses an explicit class reader factory.Default(TypePool.CacheProvider cacheProvider, ClassFileLocator classFileLocator, TypePool.Default.ReaderMode readerMode, AsmClassReader.Factory classReaderFactory, TypePool parentPool)Creates a new default type pool.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TypePool.ResolutiondoDescribe(java.lang.String name)Determines a resolution to a non-primitive, non-array type.protected TypeDescriptiondoParse(AsmClassReader classReader)Parses the supplied binary representation and returns a corresponding type description.static TypePoolof(java.lang.ClassLoader classLoader)Returns a type pool for the provided class loader.static TypePoolof(ClassFileLocator classFileLocator)Creates a defaultTypePoolthat looks up data by querying the supplied class file locator.static TypePoolofBootLoader()Creates a defaultTypePoolthat looks up data by querying the boot class loader.static TypePoolofPlatformLoader()Creates a defaultTypePoolthat looks up data by querying the plaform class loader.static TypePoolofSystemLoader()Creates a defaultTypePoolthat looks up data by querying the system class loader.-
Methods inherited from class net.bytebuddy.pool.TypePool.AbstractBase.Hierarchical
clear, describe
-
Methods inherited from class net.bytebuddy.pool.TypePool.AbstractBase
doCache
-
-
-
-
Field Detail
-
IGNORE_METHOD
@AlwaysNull private static final org.objectweb.asm.MethodVisitor IGNORE_METHOD
Indicates that a visited method should be ignored.
-
classFileLocator
protected final ClassFileLocator classFileLocator
The locator to query for finding binary data of a type.
-
readerMode
protected final TypePool.Default.ReaderMode readerMode
The reader mode to apply by this default type pool.
-
classReaderFactory
protected final AsmClassReader.Factory classReaderFactory
The class reader factory to use.
-
-
Constructor Detail
-
Default
public Default(TypePool.CacheProvider cacheProvider, ClassFileLocator classFileLocator, TypePool.Default.ReaderMode readerMode)
Creates a new default type pool without a parent pool.- Parameters:
cacheProvider- The cache provider to be used.classFileLocator- The class file locator to be used.readerMode- The reader mode to apply by this default type pool.
-
Default
public Default(TypePool.CacheProvider cacheProvider, ClassFileLocator classFileLocator, TypePool.Default.ReaderMode readerMode, TypePool parentPool)
Creates a new default type pool.- Parameters:
cacheProvider- The cache provider to be used.classFileLocator- The class file locator to be used.readerMode- The reader mode to apply by this default type pool.parentPool- The parent type pool.
-
Default
public Default(TypePool.CacheProvider cacheProvider, ClassFileLocator classFileLocator, TypePool.Default.ReaderMode readerMode, AsmClassReader.Factory classReaderFactory)
Creates a new default type pool that uses an explicit class reader factory.- Parameters:
cacheProvider- The cache provider to be used.classFileLocator- The class file locator to be used.readerMode- The reader mode to apply by this default type pool.classReaderFactory- The class reader factory to use.
-
Default
public Default(TypePool.CacheProvider cacheProvider, ClassFileLocator classFileLocator, TypePool.Default.ReaderMode readerMode, AsmClassReader.Factory classReaderFactory, TypePool parentPool)
Creates a new default type pool.- Parameters:
cacheProvider- The cache provider to be used.classFileLocator- The class file locator to be used.readerMode- The reader mode to apply by this default type pool.classReaderFactory- The class reader factory to use.parentPool- The parent type pool.
-
-
Method Detail
-
ofSystemLoader
public static TypePool ofSystemLoader()
Creates a defaultTypePoolthat looks up data by querying the system class loader. The returned instance is configured to use a fast reading mode and a simple cache.- Returns:
- A type pool that reads its data from the system class loader.
-
ofPlatformLoader
public static TypePool ofPlatformLoader()
Creates a defaultTypePoolthat looks up data by querying the plaform class loader. The returned instance is configured to use a fast reading mode and a simple cache. If the current VM is of version 8 or older, the extension class loader is represented instead.- Returns:
- A type pool that reads its data from the platform class path.
-
ofBootLoader
public static TypePool ofBootLoader()
Creates a defaultTypePoolthat looks up data by querying the boot class loader. The returned instance is configured to use a fast reading mode and a simple cache.- Returns:
- A type pool that reads its data from the boot class loader.
-
of
public static TypePool of(@MaybeNull java.lang.ClassLoader classLoader)
Returns a type pool for the provided class loader.- Parameters:
classLoader- The class loader for which this class pool is representing types.- Returns:
- An appropriate type pool.
-
of
public static TypePool of(ClassFileLocator classFileLocator)
Creates a defaultTypePoolthat looks up data by querying the supplied class file locator. The returned instance is configured to use a fast reading mode and a simple cache.- Parameters:
classFileLocator- The class file locator to use.- Returns:
- A type pool that reads its data from the system class path.
-
doDescribe
protected TypePool.Resolution doDescribe(java.lang.String name)
Description copied from class:TypePool.AbstractBaseDetermines a resolution to a non-primitive, non-array type.- Specified by:
doDescribein classTypePool.AbstractBase- Parameters:
name- The name of the type to describe.- Returns:
- A resolution to the type to describe.
-
doParse
protected TypeDescription doParse(AsmClassReader classReader)
Parses the supplied binary representation and returns a corresponding type description.- Parameters:
classReader- The ASM class reader to process.- Returns:
- An appropriate type description.
-
-