@HashCodeAndEqualsPlugin.Enhance public static class ClassInjector.UsingUnsafe.Dispatcher.Enabled extends java.lang.Object implements ClassInjector.UsingUnsafe.Dispatcher, ClassInjector.UsingUnsafe.Dispatcher.Initializable
ClassInjector.UsingUnsafe.Dispatcher.CreationAction, ClassInjector.UsingUnsafe.Dispatcher.Enabled, ClassInjector.UsingUnsafe.Dispatcher.Initializable, ClassInjector.UsingUnsafe.Dispatcher.Unavailable
Modifier and Type | Field and Description |
---|---|
private java.lang.reflect.Method |
defineClass
The
sun.misc.Unsafe#defineClass method. |
private java.lang.Object |
unsafe
An instance of
sun.misc.Unsafe . |
Modifier | Constructor and Description |
---|---|
protected |
Enabled(java.lang.Object unsafe,
java.lang.reflect.Method defineClass)
Creates an enabled dispatcher.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Class<?> |
defineClass(java.lang.ClassLoader classLoader,
java.lang.String name,
byte[] binaryRepresentation,
java.security.ProtectionDomain protectionDomain)
Defines a class.
|
ClassInjector.UsingUnsafe.Dispatcher |
initialize()
Initializes the dispatcher.
|
boolean |
isAvailable()
Checks if unsafe class injection is available on the current VM.
|
private final java.lang.Object unsafe
sun.misc.Unsafe
.private final java.lang.reflect.Method defineClass
sun.misc.Unsafe#defineClass
method.protected Enabled(java.lang.Object unsafe, java.lang.reflect.Method defineClass)
unsafe
- An instance of sun.misc.Unsafe
.defineClass
- The sun.misc.Unsafe#defineClass
method.public boolean isAvailable()
isAvailable
in interface ClassInjector.UsingUnsafe.Dispatcher.Initializable
true
if unsafe class injection is available.public ClassInjector.UsingUnsafe.Dispatcher initialize()
initialize
in interface ClassInjector.UsingUnsafe.Dispatcher.Initializable
public java.lang.Class<?> defineClass(java.lang.ClassLoader classLoader, java.lang.String name, byte[] binaryRepresentation, java.security.ProtectionDomain protectionDomain)
defineClass
in interface ClassInjector.UsingUnsafe.Dispatcher
classLoader
- The class loader to inject the class into.name
- The type's name.binaryRepresentation
- The type's binary representation.protectionDomain
- The type's protection domain.