Class 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 a TypeDescription. The data lookup is delegated to a ClassFileLocator.

TypePool.Resolutions that are produced by this type pool are either fully resolved or not resolved at all.

  • Field Details

    • IGNORE_METHOD

      @AlwaysNull 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.
    • classReaderFactory

      protected final AsmClassReader.Factory classReaderFactory
      The class reader factory to use.
  • Constructor Details

    • 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.
    • Default

      public Default(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.
      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.
    • Default

      public Default(TypePool.CacheProvider cacheProvider, ClassFileLocator classFileLocator, TypePool.Default.ReaderMode readerMode, AsmClassReader.Factory classReaderFactory, 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.
      classReaderFactory - The class reader factory to use.
      parentPool - The parent type pool.
  • Method Details

    • ofSystemLoader

      public static TypePool ofSystemLoader()
      Creates a default TypePool 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 default TypePool 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 default TypePool 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(@MaybeNull 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 default TypePool 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(String name)
      Description copied from class: TypePool.AbstractBase
      Determines a resolution to a non-primitive, non-array type.
      Specified by:
      doDescribe in class TypePool.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.