public static class ClassInjector.UsingUnsafe extends Object implements ClassInjector
sun.misc.Unsafe
to inject classes.ClassInjector.UsingInstrumentation, ClassInjector.UsingReflection, ClassInjector.UsingUnsafe
ALLOW_EXISTING_TYPES
Constructor and Description |
---|
UsingUnsafe(ClassLoader classLoader)
Creates a new unsafe injector for the given class loader with a default protection domain.
|
UsingUnsafe(ClassLoader classLoader,
ProtectionDomain protectionDomain)
Creates a new unsafe injector for the given class loader with a default protection domain.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object object) |
int |
hashCode() |
Map<TypeDescription,Class<?>> |
inject(Map<? extends TypeDescription,byte[]> types)
Injects the given types into the represented class loader.
|
static boolean |
isAvailable()
Checks if unsafe class injection is available on the current VM.
|
static ClassInjector |
ofBootstrapLoader()
Returns an unsafe class injector for the bootstrap class loader.
|
static ClassInjector |
ofClassPath()
Returns an unsafe class injector for the class path.
|
String |
toString() |
public UsingUnsafe(ClassLoader classLoader)
classLoader
- The class loader to inject classes into or null
for the bootstrap loader.public UsingUnsafe(ClassLoader classLoader, ProtectionDomain protectionDomain)
classLoader
- The class loader to inject classes into or null
for the bootstrap loader.protectionDomain
- The protection domain to use or null
for no protection domain.public static boolean isAvailable()
true
if unsafe class injection is available on the current VM.public static ClassInjector ofBootstrapLoader()
public static ClassInjector ofClassPath()
public Map<TypeDescription,Class<?>> inject(Map<? extends TypeDescription,byte[]> types)
ClassInjector
inject
in interface ClassInjector
types
- The types to load via injection.Copyright © 2014–2017. All rights reserved.