Class InjectionClassLoader

  • Direct Known Subclasses:
    ByteArrayClassLoader

    public abstract class InjectionClassLoader
    extends java.lang.ClassLoader
    An injection class loader allows for the injection of a class after the class loader was created.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  InjectionClassLoader.Strategy
      A class loading strategy for adding a type to an injection class loader.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected InjectionClassLoader​(java.lang.ClassLoader parent)
      Creates a new injection class loader.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      abstract java.lang.Class<?> defineClass​(java.lang.String name, byte[] binaryRepresentation)
      Defines a new type to be loaded by this class loader.
      abstract java.util.Map<java.lang.String,​java.lang.Class<?>> defineClasses​(java.util.Map<java.lang.String,​byte[]> typeDefinitions)
      Defines a group of types to be loaded by this class loader.
      • Methods inherited from class java.lang.ClassLoader

        clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findClass, findLibrary, findLoadedClass, findResource, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • InjectionClassLoader

        protected InjectionClassLoader​(java.lang.ClassLoader parent)
        Creates a new injection class loader.
        Parameters:
        parent - The class loader's parent.
    • Method Detail

      • defineClass

        public abstract java.lang.Class<?> defineClass​(java.lang.String name,
                                                       byte[] binaryRepresentation)
                                                throws java.lang.ClassNotFoundException
        Defines a new type to be loaded by this class loader.
        Parameters:
        name - The name of the type.
        binaryRepresentation - The type's binary representation.
        Returns:
        The defined class or a previously defined class.
        Throws:
        java.lang.ClassNotFoundException - If the class could not be loaded.
      • defineClasses

        public abstract java.util.Map<java.lang.String,​java.lang.Class<?>> defineClasses​(java.util.Map<java.lang.String,​byte[]> typeDefinitions)
                                                                                        throws java.lang.ClassNotFoundException
        Defines a group of types to be loaded by this class loader.
        Parameters:
        typeDefinitions - The types binary representations.
        Returns:
        The mapping of defined classes or previously defined classes by their name.
        Throws:
        java.lang.ClassNotFoundException - If the class could not be loaded.