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
TypePool
that models binary data in the Java byte code format into aTypeDescription
. The data lookup is delegated to aClassFileLocator
.TypePool.Resolution
s 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 interface
TypePool.Default.AnnotationRegistrant
An annotation registrant implements a visitor pattern for reading an unknown amount of values of annotations.protected static interface
TypePool.Default.ComponentTypeLocator
A component type locator allows for the lazy location of an array's component type.protected static class
TypePool.Default.GenericTypeExtractor
A generic type extractor allows for an iterative extraction of generic type information.protected static interface
TypePool.Default.GenericTypeRegistrant
A type registrant allows to register a generic type token.protected static class
TypePool.Default.LazyTypeDescription
A type description that looks up any referencedByteCodeElement
orAnnotationDescription
by querying a type pool at lookup time.protected static class
TypePool.Default.ParameterBag
A bag for collecting parameter meta information that is stored as debug information for implemented methods.static class
TypePool.Default.ReaderMode
Determines the granularity of the class file parsing that is conducted by aTypePool.Default
.protected class
TypePool.Default.TypeExtractor
A type extractor reads a class file and collects data that is relevant to create a type description.static class
TypePool.Default.WithLazyResolution
A variant ofTypePool.Default
that 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 ClassFileLocator
classFileLocator
The locator to query for finding binary data of a type.private static org.objectweb.asm.MethodVisitor
IGNORE_METHOD
Indicates that a visited method should be ignored.protected TypePool.Default.ReaderMode
readerMode
The 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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TypePool.Resolution
doDescribe(java.lang.String name)
Determines a resolution to a non-primitive, non-array type.static TypePool
of(java.lang.ClassLoader classLoader)
Returns a type pool for the provided class loader.static TypePool
of(ClassFileLocator classFileLocator)
Creates a defaultTypePool
that looks up data by querying the supplied class file locator.static TypePool
ofBootLoader()
Creates a defaultTypePool
that looks up data by querying the boot class loader.static TypePool
ofPlatformLoader()
Creates a defaultTypePool
that looks up data by querying the plaform class loader.static TypePool
ofSystemLoader()
Creates a defaultTypePool
that looks up data by querying the system class loader.private TypeDescription
parse(byte[] binaryRepresentation)
Parses a binary representation and transforms it into a type description.-
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
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.
-
-
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.
-
-
Method Detail
-
ofSystemLoader
public static TypePool ofSystemLoader()
Creates a defaultTypePool
that 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 defaultTypePool
that 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 defaultTypePool
that 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(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 defaultTypePool
that 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.AbstractBase
Determines a resolution to a non-primitive, non-array type.- Specified by:
doDescribe
in classTypePool.AbstractBase
- Parameters:
name
- The name of the type to describe.- Returns:
- A resolution to the type to describe.
-
parse
private TypeDescription parse(byte[] binaryRepresentation)
Parses a binary representation and transforms it into a type description.- Parameters:
binaryRepresentation
- The binary data to be parsed.- Returns:
- A type description of the binary data.
-
-