An injection class loader allows for the injection of a class after the class loader was created. Injection is only possible if this class loader is not sealed.
Important Note
Not sealing a class loader allows to break package encapsulation for anybody getting hold of a reference to this class loader.
| Modifier and Type | Class and Description |
|---|---|
| public static enum | InjectionClassLoader.
A class loading strategy for adding a type to an injection class loader. |
| Modifier and Type | Field and Description |
|---|---|
| private final AtomicBoolean | sealed
Indicates if this class loader is sealed, i.e. forbids runtime injection. |
| Access | Constructor and Description |
|---|---|
| protected | InjectionClassLoader(ClassLoader
The class loader's parent. parent, boolean Indicates if this class loader is sealed, i.e. forbids runtime injection. sealed)Creates a new injection class loader. |
| Modifier and Type | Method and Description |
|---|---|
| public Class | Returns: The defined class or a previously defined class.The name of the type. name, byte[] The type's binary representation. binaryRepresentation)Defines a new type to be loaded by this class loader. |
| public Map | Returns: The mapping of defined classes or previously defined classes by their name.The types binary representations. typeDefinitions)Defines a group of types to be loaded by this class loader. |
| protected abstract Map | Returns: The mapping of defined classes or previously defined classes by their name.The types binary representations. typeDefinitions)Defines a group of types to be loaded by this class loader. |
| private static void | |
| public boolean | |
| public boolean | Returns: true if the class loader was not sealed previously.Seals the class loader and returns |
| sealed | back to summary |
|---|---|
| private final AtomicBoolean sealed Indicates if this class loader is sealed, i.e. forbids runtime injection. | |
| InjectionClassLoader | back to summary |
|---|---|
| protected InjectionClassLoader(ClassLoader parent, boolean sealed) Creates a new injection class loader.
| |
| defineClass | back to summary |
|---|---|
| public Class Defines a new type to be loaded by this class loader.
| |
| defineClasses | back to summary |
|---|---|
| public Map Defines a group of types to be loaded by this class loader. If this class loader is sealed, an | |
| doDefineClasses | back to summary |
|---|---|
| protected abstract Map Defines a group of types to be loaded by this class loader. | |
| doRegisterAsParallelCapable | back to summary |
|---|---|
| private static void doRegisterAsParallelCapable() Registers class loader as parallel capable if possible.
| |
| isSealed | back to summary |
|---|---|
| public boolean isSealed() Returns
| |
| seal | back to summary |
|---|---|
| public boolean seal() Seals the class loader and returns
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final InjectionClassLoader. | INSTANCE
The singleton instance. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public Map | load(InjectionClassLoader
The class loader to used for loading the classes. classLoader, Map<TypeDescription, byte[]> Byte array representations of the types to be loaded mapped by their descriptions,
where an iteration order defines an order in which they are supposed to be loaded,
if relevant. types)Implements org. |
| public static InjectionClassLoader. | |
| public static InjectionClassLoader. |
| INSTANCE | back to summary |
|---|---|
| public static final InjectionClassLoader. The singleton instance. | |
| Strategy | back to summary |
|---|---|
| private Strategy() | |
| load | back to summary |
|---|---|
| public Map Implements org. Doc from org. Loads a given collection of classes given their binary representation.
| |
| valueOf | back to summary |
|---|---|
| public static InjectionClassLoader. | |
| values | back to summary |
|---|---|
| public static InjectionClassLoader. | |