Class ModelTypePool
- java.lang.Object
-
- net.bytebuddy.pool.TypePool.AbstractBase
-
- net.bytebuddy.pool.TypePool.AbstractBase.Hierarchical
-
- net.bytebuddy.pool.TypePool.Default
-
- org.hibernate.bytecode.enhance.internal.bytebuddy.ModelTypePool
-
- All Implemented Interfaces:
net.bytebuddy.pool.TypePool
,EnhancerClassLocator
public class ModelTypePool extends net.bytebuddy.pool.TypePool.Default implements EnhancerClassLocator
A TypePool suitable for loading user's classes, potentially in parallel operations.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.bytebuddy.pool.TypePool.Default
net.bytebuddy.pool.TypePool.Default.AnnotationRegistrant, net.bytebuddy.pool.TypePool.Default.ComponentTypeLocator, net.bytebuddy.pool.TypePool.Default.GenericTypeExtractor, net.bytebuddy.pool.TypePool.Default.GenericTypeRegistrant, net.bytebuddy.pool.TypePool.Default.LazyTypeDescription, net.bytebuddy.pool.TypePool.Default.ParameterBag, net.bytebuddy.pool.TypePool.Default.ReaderMode, net.bytebuddy.pool.TypePool.Default.TypeExtractor, net.bytebuddy.pool.TypePool.Default.WithLazyResolution
-
Nested classes/interfaces inherited from class net.bytebuddy.pool.TypePool.AbstractBase
net.bytebuddy.pool.TypePool.AbstractBase.ArrayTypeResolution, net.bytebuddy.pool.TypePool.AbstractBase.ComponentTypeReference, net.bytebuddy.pool.TypePool.AbstractBase.Hierarchical
-
Nested classes/interfaces inherited from interface net.bytebuddy.pool.TypePool
net.bytebuddy.pool.TypePool.AbstractBase, net.bytebuddy.pool.TypePool.CacheProvider, net.bytebuddy.pool.TypePool.ClassLoading, net.bytebuddy.pool.TypePool.Default, net.bytebuddy.pool.TypePool.Empty, net.bytebuddy.pool.TypePool.Explicit, net.bytebuddy.pool.TypePool.LazyFacade, net.bytebuddy.pool.TypePool.Resolution
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description net.bytebuddy.dynamic.ClassFileLocator
asClassFileLocator()
static EnhancerClassLocator
buildModelTypePool(ClassLoader classLoader)
Creates a new empty EnhancerClassLocator instance which will load any application classes that need being reflected on from the ClassLoader passed as parameter.static EnhancerClassLocator
buildModelTypePool(net.bytebuddy.dynamic.ClassFileLocator classFileLocator)
Similar tobuildModelTypePool(ClassLoader)
except the application classes are not necessarily sourced from a standard classloader: it accepts aClassFileLocator
, which offers some more flexibility.static EnhancerClassLocator
buildModelTypePool(net.bytebuddy.dynamic.ClassFileLocator classFileLocator, CoreTypePool coreTypePool)
Similar tobuildModelTypePool(ClassFileLocator)
but allows specifying an existingCoreTypePool
to be used as parent pool.void
deregisterClassNameAndBytes(String className)
This can optionally be used to remove an explicit mapping when it's no longer essential to retain it.void
registerClassNameAndBytes(String className, byte[] bytes)
Register a new class to the locator explicitly.-
Methods inherited from class net.bytebuddy.pool.TypePool.Default
doDescribe, of, of, ofBootLoader, ofPlatformLoader, ofSystemLoader
-
-
-
-
Method Detail
-
buildModelTypePool
public static EnhancerClassLocator buildModelTypePool(ClassLoader classLoader)
Creates a new empty EnhancerClassLocator instance which will load any application classes that need being reflected on from the ClassLoader passed as parameter. This TypePool will delegate, parent first, to a newly constructed empty instance of CoreTypePool; this parent pool will be used to load non-application types from the Hibernate classloader instead, not the one specified as argument.- Parameters:
classLoader
-- Returns:
- the newly created EnhancerClassLocator
- See Also:
CoreTypePool
-
buildModelTypePool
public static EnhancerClassLocator buildModelTypePool(net.bytebuddy.dynamic.ClassFileLocator classFileLocator)
Similar tobuildModelTypePool(ClassLoader)
except the application classes are not necessarily sourced from a standard classloader: it accepts aClassFileLocator
, which offers some more flexibility.- Parameters:
classFileLocator
-- Returns:
- the newly created EnhancerClassLocator
-
buildModelTypePool
public static EnhancerClassLocator buildModelTypePool(net.bytebuddy.dynamic.ClassFileLocator classFileLocator, CoreTypePool coreTypePool)
Similar tobuildModelTypePool(ClassFileLocator)
but allows specifying an existingCoreTypePool
to be used as parent pool. This forms allows constructing a custom CoreTypePool and also separated the cache of the parent pool, which might be useful to reuse for multiple enhancement processes while desiring a clean new state for theModelTypePool
.- Parameters:
classFileLocator
-coreTypePool
-- Returns:
-
registerClassNameAndBytes
public void registerClassNameAndBytes(String className, byte[] bytes)
Description copied from interface:EnhancerClassLocator
Register a new class to the locator explicitly.- Specified by:
registerClassNameAndBytes
in interfaceEnhancerClassLocator
-
deregisterClassNameAndBytes
public void deregisterClassNameAndBytes(String className)
Description copied from interface:EnhancerClassLocator
This can optionally be used to remove an explicit mapping when it's no longer essential to retain it. The underlying implementation might ignore the operation.- Specified by:
deregisterClassNameAndBytes
in interfaceEnhancerClassLocator
-
asClassFileLocator
public net.bytebuddy.dynamic.ClassFileLocator asClassFileLocator()
- Specified by:
asClassFileLocator
in interfaceEnhancerClassLocator
- Returns:
- the underlying
ClassFileLocator
-
-