@HashCodeAndEqualsPlugin.Enhance public static class ClassLoadingStrategy.ForUnsafeInjection extends java.lang.Object implements ClassLoadingStrategy<java.lang.ClassLoader>
A class loading strategy that injects a class using sun.misc.Unsafe
.
Important: This strategy is no longer available after Java 11.
ClassLoadingStrategy.Configurable<S extends java.lang.ClassLoader>, ClassLoadingStrategy.Default, ClassLoadingStrategy.ForBootstrapInjection, ClassLoadingStrategy.ForUnsafeInjection, ClassLoadingStrategy.UsingLookup
Modifier and Type | Field and Description |
---|---|
private java.security.ProtectionDomain |
protectionDomain
The protection domain to use or
null if no protection domain is set. |
BOOTSTRAP_LOADER, NO_PROTECTION_DOMAIN
Constructor and Description |
---|
ForUnsafeInjection()
Creates a new class loading strategy for unsafe injection with a default protection domain.
|
ForUnsafeInjection(java.security.ProtectionDomain protectionDomain)
Creates a new class loading strategy for unsafe injection.
|
Modifier and Type | Method and Description |
---|---|
java.util.Map<TypeDescription,java.lang.Class<?>> |
load(java.lang.ClassLoader classLoader,
java.util.Map<TypeDescription,byte[]> types)
Loads a given collection of classes given their binary representation.
|
@HashCodeAndEqualsPlugin.ValueHandling(value=REVERSE_NULLABILITY) private final java.security.ProtectionDomain protectionDomain
null
if no protection domain is set.public ForUnsafeInjection()
public ForUnsafeInjection(java.security.ProtectionDomain protectionDomain)
protectionDomain
- The protection domain to use or null
if no protection domain is set.public java.util.Map<TypeDescription,java.lang.Class<?>> load(java.lang.ClassLoader classLoader, java.util.Map<TypeDescription,byte[]> types)
load
in interface ClassLoadingStrategy<java.lang.ClassLoader>
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.