Package net.bytebuddy.pool
Class TypePool.Default.WithLazyResolution
- java.lang.Object
-
- net.bytebuddy.pool.TypePool.AbstractBase
-
- net.bytebuddy.pool.TypePool.AbstractBase.Hierarchical
-
- net.bytebuddy.pool.TypePool.Default
-
- net.bytebuddy.pool.TypePool.Default.WithLazyResolution
-
- All Implemented Interfaces:
TypePool
- Enclosing class:
- TypePool.Default
public static class TypePool.Default.WithLazyResolution extends TypePool.Default
A variant of
TypePool.Default
that resolves type descriptions lazily. A lazy resolution respects this type pool'sTypePool.CacheProvider
but requeries this cache pool for every access of a property of aTypeDescription
.TypePool.Resolution
s of this type pool are only fully resolved if a property that is not the type's name is required.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
TypePool.Default.WithLazyResolution.LazyResolution
A lazy resolution of a type that the enclosing type pool attempts to resolve.protected class
TypePool.Default.WithLazyResolution.LazyTypeDescription
A lazy type description that resolves any property that is not the name only when requested.-
Nested classes/interfaces inherited from class net.bytebuddy.pool.TypePool.Default
TypePool.Default.AnnotationRegistrant, TypePool.Default.ComponentTypeLocator, TypePool.Default.GenericTypeExtractor, TypePool.Default.GenericTypeRegistrant, TypePool.Default.ParameterBag, TypePool.Default.ReaderMode, TypePool.Default.TypeExtractor, TypePool.Default.WithLazyResolution
-
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 inherited from class net.bytebuddy.pool.TypePool.Default
classFileLocator, readerMode
-
Fields inherited from class net.bytebuddy.pool.TypePool.AbstractBase
cacheProvider, PRIMITIVE_DESCRIPTORS, PRIMITIVE_TYPES
-
-
Constructor Summary
Constructors Constructor Description WithLazyResolution(TypePool.CacheProvider cacheProvider, ClassFileLocator classFileLocator, TypePool.Default.ReaderMode readerMode)
Creates a new default type pool with lazy resolution and without a parent pool.WithLazyResolution(TypePool.CacheProvider cacheProvider, ClassFileLocator classFileLocator, TypePool.Default.ReaderMode readerMode, TypePool parentPool)
Creates a new default type pool with lazy resolution.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TypePool.Resolution
doCache(java.lang.String name, TypePool.Resolution resolution)
Writes the resolution to the cache.protected TypePool.Resolution
doDescribe(java.lang.String name)
Determines a resolution to a non-primitive, non-array type.protected TypePool.Resolution
doResolve(java.lang.String name)
Non-lazily resolves a type name.static TypePool
of(java.lang.ClassLoader classLoader)
Returns a defaultTypePool
with lazy resolution for the provided class loader.static TypePool
of(ClassFileLocator classFileLocator)
Creates a defaultTypePool
with lazy resolution that looks up data by querying the supplied class file locator.static TypePool
ofBootLoader()
Creates a defaultTypePool
with lazy resolution that looks up data by querying the boot class loader.static TypePool
ofPlatformLoader()
Creates a defaultTypePool
with lazy resolution that looks up data by querying the platform class loader.static TypePool
ofSystemLoader()
Creates a defaultTypePool
with lazy resolution that looks up data by querying the system class loader.-
Methods inherited from class net.bytebuddy.pool.TypePool.AbstractBase.Hierarchical
clear, describe
-
-
-
-
Constructor Detail
-
WithLazyResolution
public WithLazyResolution(TypePool.CacheProvider cacheProvider, ClassFileLocator classFileLocator, TypePool.Default.ReaderMode readerMode)
Creates a new default type pool with lazy resolution and 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.
-
WithLazyResolution
public WithLazyResolution(TypePool.CacheProvider cacheProvider, ClassFileLocator classFileLocator, TypePool.Default.ReaderMode readerMode, TypePool parentPool)
Creates a new default type pool with lazy resolution.- 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
with lazy resolution 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
with lazy resolution that looks up data by querying the platform class loader. The returned instance is configured to use a fast reading mode and a simple cache. If the current VM is Java 8 or older, the type pool represents the extension class loader.- Returns:
- A type pool that reads its data from the boot class loader.
-
ofBootLoader
public static TypePool ofBootLoader()
Creates a defaultTypePool
with lazy resolution 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 defaultTypePool
with lazy resolution 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
with lazy resolution 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.- Overrides:
doDescribe
in classTypePool.Default
- Parameters:
name
- The name of the type to describe.- Returns:
- A resolution to the type to describe.
-
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.- Overrides:
doCache
in classTypePool.AbstractBase
- 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.
-
doResolve
protected TypePool.Resolution doResolve(java.lang.String name)
Non-lazily resolves a type name.- Parameters:
name
- The name of the type to resolve.- Returns:
- The resolution for the type of this name.
-
-