Package net.bytebuddy.dynamic.loading
Class ClassLoadingStrategy.ForUnsafeInjection
java.lang.Object
net.bytebuddy.dynamic.loading.ClassLoadingStrategy.ForUnsafeInjection
- All Implemented Interfaces:
ClassLoadingStrategy<ClassLoader>
- Enclosing interface:
ClassLoadingStrategy<T extends ClassLoader>
@Enhance
public static class ClassLoadingStrategy.ForUnsafeInjection
extends Object
implements ClassLoadingStrategy<ClassLoader>
A class loading strategy that injects a class using
sun.misc.Unsafe
or jdk.internal.misc.Unsafe
.-
Nested Class Summary
Nested classes/interfaces inherited from interface net.bytebuddy.dynamic.loading.ClassLoadingStrategy
ClassLoadingStrategy.Configurable<S extends ClassLoader>, ClassLoadingStrategy.Default, ClassLoadingStrategy.ForBootstrapInjection, ClassLoadingStrategy.ForJnaInjection, ClassLoadingStrategy.ForUnsafeInjection, ClassLoadingStrategy.UsingLookup
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ProtectionDomain
The protection domain to use ornull
if no protection domain is set.Fields inherited from interface net.bytebuddy.dynamic.loading.ClassLoadingStrategy
BOOTSTRAP_LOADER, NO_PROTECTION_DOMAIN
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new class loading strategy for unsafe injection with a default protection domain.ForUnsafeInjection
(ProtectionDomain protectionDomain) Creates a new class loading strategy for unsafe injection. -
Method Summary
Modifier and TypeMethodDescriptionMap
<TypeDescription, Class<?>> load
(ClassLoader classLoader, Map<TypeDescription, byte[]> types) Loads a given collection of classes given their binary representation.
-
Field Details
-
protectionDomain
The protection domain to use ornull
if no protection domain is set.
-
-
Constructor Details
-
ForUnsafeInjection
public ForUnsafeInjection()Creates a new class loading strategy for unsafe injection with a default protection domain. -
ForUnsafeInjection
Creates a new class loading strategy for unsafe injection.- Parameters:
protectionDomain
- The protection domain to use ornull
if no protection domain is set.
-
-
Method Details
-
load
public Map<TypeDescription,Class<?>> load(@MaybeNull ClassLoader classLoader, Map<TypeDescription, byte[]> types) Loads a given collection of classes given their binary representation.- Specified by:
load
in interfaceClassLoadingStrategy<ClassLoader>
- Parameters:
classLoader
- The class loader to used for loading the classes.types
- 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.- Returns:
- A collection of the loaded classes which will be initialized in the iteration order of the returned collection.
-