Package javassist

# Class Loader.Simple

java.lang.Object
java.lang.ClassLoader
javassist.Loader.Simple

Enclosing class:
  `Loader`

public static class Loader.Simple extends 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(ClassLoader parent)`
Constructs a class loader.

## Method Summary

Modifier and Type
Method
Description
`Class<?>`
`invokeDefineClass(CtClass cc)`
Invokes the protected `defineClass()` in `ClassLoader`.

### Methods inherited from class java.lang.ClassLoader

`clearAssertionStatus, getDefinedPackage, getDefinedPackages, getName, getParent, getPlatformClassLoader, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### Simple

public Simple()
Constructs a class loader.

### Simple

public Simple(ClassLoader parent)
Constructs a class loader.

Parameters:
  `parent` - the parent class loader.

## Method Details

### invokeDefineClass

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

Throws:
  `IOException`
  `CannotCompileException`