Package javassist

Class Loader.Simple

  • Enclosing class:
    Loader

    public static class Loader.Simple
    extends java.lang.ClassLoader
    A simpler class loader. This is a class loader that exposes the protected defineClass() method declared in java.lang.ClassLoader. It provides a method similar to CtClass#toClass().

    When loading a class, this class loader delegates the work to the parent class loader unless the loaded classes are explicitly given by invokeDefineClass(CtClass). Note that a class Foo loaded by this class loader is different from the class with the same name Foo but loaded by another class loader. This is Java's naming rule.

    Since:
    3.24
    • Constructor Summary

      Constructors 
      Constructor Description
      Simple()
      Constructs a class loader.
      Simple​(java.lang.ClassLoader parent)
      Constructs a class loader.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Class<?> invokeDefineClass​(CtClass cc)
      Invokes the protected defineClass() in ClassLoader.
      • 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

      • Simple

        public Simple()
        Constructs a class loader.
      • Simple

        public Simple​(java.lang.ClassLoader parent)
        Constructs a class loader.
        Parameters:
        parent - the parent class loader.
    • Method Detail

      • invokeDefineClass

        public java.lang.Class<?> invokeDefineClass​(CtClass cc)
                                             throws java.io.IOException,
                                                    CannotCompileException
        Invokes the protected defineClass() in ClassLoader. It converts the given CtClass object into a java.lang.Class object.
        Throws:
        java.io.IOException
        CannotCompileException