Enum ByteArrayClassLoader.PersistenceHandler

java.lang.Object
java.lang.Enum<ByteArrayClassLoader.PersistenceHandler>
net.bytebuddy.dynamic.loading.ByteArrayClassLoader.PersistenceHandler
All Implemented Interfaces:
Serializable, Comparable<ByteArrayClassLoader.PersistenceHandler>, java.lang.constant.Constable
Enclosing class:
ByteArrayClassLoader

public static enum ByteArrayClassLoader.PersistenceHandler extends Enum<ByteArrayClassLoader.PersistenceHandler>
A persistence handler decides on whether the byte array that represents a loaded class is exposed by the ClassLoader.getResourceAsStream(String) method.
  • Enum Constant Details

  • Field Details

    • CLASS_FILE_SUFFIX

      private static final String CLASS_FILE_SUFFIX
      The suffix of files in the Java class file format.
      See Also:
    • manifest

      private final boolean manifest
      true if this persistence handler represents manifest class file storage.
  • Constructor Details

    • PersistenceHandler

      private PersistenceHandler(boolean manifest)
      Creates a new persistence handler.
      Parameters:
      manifest - true if this persistence handler represents manifest class file storage.
  • Method Details

    • values

      public static ByteArrayClassLoader.PersistenceHandler[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static ByteArrayClassLoader.PersistenceHandler valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • isManifest

      public boolean isManifest()
      Checks if this persistence handler represents manifest class file storage.
      Returns:
      true if this persistence handler represents manifest class file storage.
    • lookup

      @MaybeNull protected abstract byte[] lookup(String name, ConcurrentMap<String,byte[]> typeDefinitions)
      Performs a lookup of a class file by its name.
      Parameters:
      name - The name of the class to be loaded.
      typeDefinitions - A map of fully qualified class names pointing to their binary representations.
      Returns:
      The byte array representing the requested class or null if no such class is known.
    • url

      @MaybeNull protected abstract URL url(String resourceName, ConcurrentMap<String,byte[]> typeDefinitions)
      Returns a URL representing a class file.
      Parameters:
      resourceName - The name of the requested resource.
      typeDefinitions - A mapping of byte arrays by their type names.
      Returns:
      A URL representing the type definition or null if the requested resource does not represent a class file.
    • release

      protected abstract void release(String name, ConcurrentMap<String,byte[]> typeDefinitions)
      Removes the binary representation of the supplied type if this class loader is latent.
      Parameters:
      name - The name of the type.
      typeDefinitions - A mapping of byte arrays by their type names.