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
A variant of TypePool.Default that resolves type descriptions lazily. A lazy resolution respects this type
pool's TypePool.CacheProvider but requeries this cache pool for every access of a property of a TypeDescription.
TypePool.Resolutions of this type pool are only fully resolved if a property that is not the type's name is required.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classRepresents a type description where the class file is only fully parsed if a complex property is resolved.static enumDescribes the mode of lazy resolution to apply.protected classA lazy resolution of a type that the enclosing type pool attempts to resolve.protected classA lazy type description that resolves any property that is not the name only when requested.Nested classes/interfaces inherited from class 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.WithLazyResolutionNested classes/interfaces inherited from class TypePool.AbstractBase
TypePool.AbstractBase.ArrayTypeResolution, TypePool.AbstractBase.ComponentTypeReference, TypePool.AbstractBase.HierarchicalNested classes/interfaces inherited from interface TypePool
TypePool.AbstractBase, TypePool.CacheProvider, TypePool.ClassLoading, TypePool.Default, TypePool.Empty, TypePool.Explicit, TypePool.LazyFacade, TypePool.Resolution -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TypePool.Default.WithLazyResolution.LazinessModeThe mode of lazy resolution.Fields inherited from class TypePool.Default
classFileLocator, classReaderFactory, readerModeFields inherited from class TypePool.AbstractBase
cacheProvider, PRIMITIVE_DESCRIPTORS, PRIMITIVE_TYPES -
Constructor Summary
ConstructorsConstructorDescriptionWithLazyResolution(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.WithLazyResolution(TypePool.CacheProvider cacheProvider, ClassFileLocator classFileLocator, TypePool.Default.ReaderMode readerMode, TypePool.Default.WithLazyResolution.LazinessMode lazinessMode) 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, TypePool.Default.WithLazyResolution.LazinessMode lazinessMode) Creates a new default type pool with lazy resolution.WithLazyResolution(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 with lazy resolution.WithLazyResolution(TypePool.CacheProvider cacheProvider, ClassFileLocator classFileLocator, TypePool.Default.ReaderMode readerMode, AsmClassReader.Factory classReaderFactory, TypePool parentPool) Creates a new default type pool that uses an explicit class reader factory with lazy resolution.WithLazyResolution(TypePool.CacheProvider cacheProvider, ClassFileLocator classFileLocator, TypePool.Default.ReaderMode readerMode, AsmClassReader.Factory classReaderFactory, TypePool.Default.WithLazyResolution.LazinessMode lazinessMode) Creates a new default type pool that uses an explicit class reader factory with lazy resolution.WithLazyResolution(TypePool.CacheProvider cacheProvider, ClassFileLocator classFileLocator, TypePool.Default.ReaderMode readerMode, AsmClassReader.Factory classReaderFactory, TypePool parentPool, TypePool.Default.WithLazyResolution.LazinessMode lazinessMode) Creates a new default type pool that uses an explicit class reader factory with lazy resolution. -
Method Summary
Modifier and TypeMethodDescriptionprotected TypePool.ResolutiondoCache(String name, TypePool.Resolution resolution) Writes the resolution to the cache.protected TypePool.ResolutiondoDescribe(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.protected TypePool.ResolutionNon-lazily resolves a type name.static TypePoolof(ClassLoader classLoader) Returns a defaultTypePoolwith lazy resolution for the provided class loader.static TypePoolof(ClassFileLocator classFileLocator) Creates a defaultTypePoolwith lazy resolution that looks up data by querying the supplied class file locator.static TypePoolCreates a defaultTypePoolwith lazy resolution that looks up data by querying the boot class loader.static TypePoolCreates a defaultTypePoolwith lazy resolution that looks up data by querying the platform class loader.static TypePoolCreates a defaultTypePoolwith lazy resolution that looks up data by querying the system class loader.Methods inherited from class TypePool.AbstractBase.Hierarchical
clear, describe
-
Field Details
-
lazinessMode
The mode of lazy resolution.
-
-
Constructor Details
-
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.
-
WithLazyResolution
public WithLazyResolution(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 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.classReaderFactory- The class reader factory to use.
-
WithLazyResolution
public WithLazyResolution(TypePool.CacheProvider cacheProvider, ClassFileLocator classFileLocator, TypePool.Default.ReaderMode readerMode, AsmClassReader.Factory classReaderFactory, TypePool parentPool) Creates a new default type pool that uses an explicit class reader factory 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.classReaderFactory- The class reader factory to use.parentPool- The parent type pool.
-
WithLazyResolution
public WithLazyResolution(TypePool.CacheProvider cacheProvider, ClassFileLocator classFileLocator, TypePool.Default.ReaderMode readerMode, TypePool.Default.WithLazyResolution.LazinessMode lazinessMode) 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.lazinessMode- The mode of lazy resolution.
-
WithLazyResolution
public WithLazyResolution(TypePool.CacheProvider cacheProvider, ClassFileLocator classFileLocator, TypePool.Default.ReaderMode readerMode, TypePool parentPool, TypePool.Default.WithLazyResolution.LazinessMode lazinessMode) 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.lazinessMode- The mode of lazy resolution.
-
WithLazyResolution
public WithLazyResolution(TypePool.CacheProvider cacheProvider, ClassFileLocator classFileLocator, TypePool.Default.ReaderMode readerMode, AsmClassReader.Factory classReaderFactory, TypePool.Default.WithLazyResolution.LazinessMode lazinessMode) Creates a new default type pool that uses an explicit class reader factory 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.classReaderFactory- The class reader factory to use.lazinessMode- The mode of lazy resolution.
-
WithLazyResolution
public WithLazyResolution(TypePool.CacheProvider cacheProvider, ClassFileLocator classFileLocator, TypePool.Default.ReaderMode readerMode, AsmClassReader.Factory classReaderFactory, TypePool parentPool, TypePool.Default.WithLazyResolution.LazinessMode lazinessMode) Creates a new default type pool that uses an explicit class reader factory 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.classReaderFactory- The class reader factory to use.parentPool- The parent type pool.lazinessMode- The mode of lazy resolution.
-
-
Method Details
-
ofSystemLoader
-
ofPlatformLoader
Creates a defaultTypePoolwith 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
-
of
Returns a defaultTypePoolwith 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
Creates a defaultTypePoolwith 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
Description copied from class:TypePool.AbstractBaseDetermines a resolution to a non-primitive, non-array type.- Overrides:
doDescribein classTypePool.Default- Parameters:
name- The name of the type to describe.- Returns:
- A resolution to the type to describe.
-
doParse
Description copied from class:TypePool.DefaultParses the supplied binary representation and returns a corresponding type description.- Overrides:
doParsein classTypePool.Default- Parameters:
classReader- The ASM class reader to process.- Returns:
- An appropriate type description.
-
doCache
Description copied from class:TypePool.AbstractBaseWrites the resolution to the cache. This method should be overridden if the directly resolved instance should not be added to the cache.- Overrides:
doCachein 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
Non-lazily resolves a type name.- Parameters:
name- The name of the type to resolve.- Returns:
- The resolution for the type of this name.
-