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
  • Field Summary

    Fields inherited from class net.bytebuddy.pool.TypePool.Default

    classFileLocator, classReaderFactory, readerMode

    Fields inherited from class net.bytebuddy.pool.TypePool.AbstractBase

    cacheProvider, PRIMITIVE_DESCRIPTORS, PRIMITIVE_TYPES
  • Method Summary

    Modifier and Type
    Method
    Description
    net.bytebuddy.dynamic.ClassFileLocator
     
    Creates a new empty EnhancerClassLocator instance which will load any application classes that need being reflected on from the ClassLoader passed as parameter.
    buildModelTypePool(net.bytebuddy.dynamic.ClassFileLocator classFileLocator)
    Similar to buildModelTypePool(ClassLoader) except the application classes are not necessarily sourced from a standard classloader: it accepts a ClassFileLocator, which offers some more flexibility.
    buildModelTypePool(net.bytebuddy.dynamic.ClassFileLocator classFileLocator, CoreTypePool coreTypePool)
    Similar to buildModelTypePool(ClassFileLocator) but allows specifying an existing CoreTypePool to be used as parent pool.
    void
    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, doParse, equals, hashCode, of, of, ofBootLoader, ofPlatformLoader, ofSystemLoader

    Methods inherited from class net.bytebuddy.pool.TypePool.AbstractBase.Hierarchical

    clear, describe

    Methods inherited from class net.bytebuddy.pool.TypePool.AbstractBase

    doCache

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.bytebuddy.pool.TypePool

    clear, describe
  • Method Details

    • 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:
    • buildModelTypePool

      public static EnhancerClassLocator buildModelTypePool(net.bytebuddy.dynamic.ClassFileLocator classFileLocator)
      Similar to buildModelTypePool(ClassLoader) except the application classes are not necessarily sourced from a standard classloader: it accepts a ClassFileLocator, 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 to buildModelTypePool(ClassFileLocator) but allows specifying an existing CoreTypePool 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 the ModelTypePool.
      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 interface EnhancerClassLocator
      Parameters:
      className -
      bytes -
    • 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 interface EnhancerClassLocator
      Parameters:
      className -
    • asClassFileLocator

      public net.bytebuddy.dynamic.ClassFileLocator asClassFileLocator()
      Specified by:
      asClassFileLocator in interface EnhancerClassLocator
      Returns:
      the underlying ClassFileLocator