Package net.bytebuddy.dynamic.loading
Class ClassInjector.UsingUnsafe.Dispatcher.Enabled
- java.lang.Object
-
- net.bytebuddy.dynamic.loading.ClassInjector.UsingUnsafe.Dispatcher.Enabled
-
- All Implemented Interfaces:
ClassInjector.UsingUnsafe.Dispatcher,ClassInjector.UsingUnsafe.Dispatcher.Initializable
- Enclosing interface:
- ClassInjector.UsingUnsafe.Dispatcher
@Enhance public static class ClassInjector.UsingUnsafe.Dispatcher.Enabled extends java.lang.Object implements ClassInjector.UsingUnsafe.Dispatcher, ClassInjector.UsingUnsafe.Dispatcher.Initializable
An enabled dispatcher.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.dynamic.loading.ClassInjector.UsingUnsafe.Dispatcher
ClassInjector.UsingUnsafe.Dispatcher.CreationAction, ClassInjector.UsingUnsafe.Dispatcher.Enabled, ClassInjector.UsingUnsafe.Dispatcher.Initializable, ClassInjector.UsingUnsafe.Dispatcher.Unavailable
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.reflect.MethoddefineClassThesun.misc.Unsafe#defineClassorjdk.internal.misc.Unsafe#defineClassmethod.private java.lang.ObjectunsafeAn instance ofsun.misc.Unsafeorjdk.internal.misc.Unsafe.
-
Constructor Summary
Constructors Modifier Constructor Description protectedEnabled(java.lang.Object unsafe, java.lang.reflect.Method defineClass)Creates an enabled dispatcher.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Class<?>defineClass(java.lang.ClassLoader classLoader, java.lang.String name, byte[] binaryRepresentation, java.security.ProtectionDomain protectionDomain)Defines a class.ClassInjector.UsingUnsafe.Dispatcherinitialize()Initializes the dispatcher.booleanisAvailable()Checks if unsafe class injection is available on the current VM.
-
-
-
Constructor Detail
-
Enabled
protected Enabled(java.lang.Object unsafe, java.lang.reflect.Method defineClass)Creates an enabled dispatcher.- Parameters:
unsafe- An instance ofsun.misc.Unsafeorjdk.internal.misc.Unsafe.defineClass- Thesun.misc.Unsafe#defineClassorjdk.internal.misc.Unsafe#defineClassmethod.
-
-
Method Detail
-
isAvailable
public boolean isAvailable()
Checks if unsafe class injection is available on the current VM.- Specified by:
isAvailablein interfaceClassInjector.UsingUnsafe.Dispatcher.Initializable- Returns:
trueif unsafe class injection is available.
-
initialize
public ClassInjector.UsingUnsafe.Dispatcher initialize()
Initializes the dispatcher.- Specified by:
initializein interfaceClassInjector.UsingUnsafe.Dispatcher.Initializable- Returns:
- The initialized dispatcher.
-
defineClass
public java.lang.Class<?> defineClass(@MaybeNull java.lang.ClassLoader classLoader, java.lang.String name, byte[] binaryRepresentation, @MaybeNull java.security.ProtectionDomain protectionDomain)
Defines a class.- Specified by:
defineClassin interfaceClassInjector.UsingUnsafe.Dispatcher- Parameters:
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.- Returns:
- The defined class.
-
-