public class ClassLoaderByteArrayInjector extends Object
ClassLoader.
 Note that the injector is only able to load classes in a linear manner. Thus, classes that refer to other classes which are not yet loaded cannot be injected but will result in a
NoClassDefFoundError. This becomes
 a problem when classes refer to each other using cyclic references. This injector can further not be applied to the
 bootstrap class loader which is usually represented by a null value and can therefore not be accessed by
 reflection.| Modifier and Type | Class and Description | 
|---|---|
protected class  | 
ClassLoaderByteArrayInjector.ClassLoadingAction
A privileged action for loading a class reflectively. 
 | 
protected static interface  | 
ClassLoaderByteArrayInjector.ReflectionStore
A storage for method representations in order to access a class loader reflectively. 
 | 
| Constructor and Description | 
|---|
ClassLoaderByteArrayInjector(ClassLoader classLoader)
Creates a new injector for the given  
ClassLoader and a default
 ProtectionDomain. | 
ClassLoaderByteArrayInjector(ClassLoader classLoader,
                            ProtectionDomain protectionDomain)
Creates a new injector for the given  
ClassLoader and ProtectionDomain. | 
| Modifier and Type | Method and Description | 
|---|---|
static Map<TypeDescription,Class<?>> | 
inject(ClassLoaderByteArrayInjector classLoaderByteArrayInjector,
      Map<TypeDescription,byte[]> types)
Injects a given type mapping into a class loader byte array injector. 
 | 
Class<?> | 
inject(String name,
      byte[] binaryRepresentation)
Explicitly loads a  
Class by reflective access into the represented class loader. | 
String | 
toString()  | 
public ClassLoaderByteArrayInjector(ClassLoader classLoader)
ClassLoader and a default
 ProtectionDomain.classLoader - The ClassLoader into which new class definitions are to be injected.public ClassLoaderByteArrayInjector(ClassLoader classLoader, ProtectionDomain protectionDomain)
ClassLoader and ProtectionDomain.classLoader - The ClassLoader into which new class definitions are to be injected.protectionDomain - The protection domain to apply during class definition.public static Map<TypeDescription,Class<?>> inject(ClassLoaderByteArrayInjector classLoaderByteArrayInjector, Map<TypeDescription,byte[]> types)
classLoaderByteArrayInjector - The target of the injection.types - A mapping of types to their binary representation.public Class<?> inject(String name, byte[] binaryRepresentation)
Class by reflective access into the represented class loader.name - The fully qualified name of the Class to be loaded.binaryRepresentation - The type's binary representation.Copyright © 2014. All rights reserved.