Class ClassFileLocator.MultiReleaseAware

java.lang.Object
net.bytebuddy.dynamic.ClassFileLocator.MultiReleaseAware
All Implemented Interfaces:
Closeable, AutoCloseable, ClassFileLocator
Direct Known Subclasses:
ClassFileLocator.ForFolder, ClassFileLocator.ForJarFile
Enclosing interface:
ClassFileLocator

@Enhance public abstract static class ClassFileLocator.MultiReleaseAware extends Object implements ClassFileLocator
A class file locator that is aware of multi-release JAR file semantics.
  • Field Details

    • MULTI_RELEASE_ATTRIBUTE

      private static final String MULTI_RELEASE_ATTRIBUTE
      The property name of a multi-release JAR file.
      See Also:
    • NO_MULTI_RELEASE

      protected static final int[] NO_MULTI_RELEASE
      Indicates that no multi-release versions exist.
    • version

      private final int[] version
      Contains the existing multi-release jar folders that are available for the current JVM version in decreasing order.
  • Constructor Details

    • MultiReleaseAware

      protected MultiReleaseAware(int[] version)
      Creates a multi-release aware class file locator.
      Parameters:
      version - Contains the existing multi-release jar folders that are available for the current JVM version in decreasing order.
  • Method Details

    • locate

      public ClassFileLocator.Resolution locate(String name) throws IOException
      Locates the class file for a given type and returns the binary data of the class file.
      Specified by:
      locate in interface ClassFileLocator
      Parameters:
      name - The name of the type to locate a class file representation for.
      Returns:
      Any binary representation of the type which might be illegal.
      Throws:
      IOException - If reading a class file causes an error.
    • doLocate

      @MaybeNull protected abstract byte[] doLocate(String path) throws IOException
      Resolves a possible multi-release entry, if it exists.
      Parameters:
      path - The path of the class file.
      Returns:
      The class file's binary representation or null if it does not exist.
      Throws:
      IOException - If an I/O exception occurs.