@HashCodeAndEqualsPlugin.Enhance public static class ClassInjector.UsingUnsafe.Factory extends Object
ClassInjector that uses sun.misc.Unsafe if available but attempts a fallback
 to using jdk.internal.misc.Unsafe if the jdk.internal module is not resolved or unavailable.| Modifier and Type | Class and Description | 
|---|---|
| static interface  | ClassInjector.UsingUnsafe.Factory.AccessResolverAn access resolver that invokes  AccessibleObject.setAccessible(boolean)totruein a given privilege scope. | 
| Modifier | Constructor and Description | 
|---|---|
|   | Factory()Creates a new factory for an unsafe class injector that uses Byte Buddy's privileges to
 accessing  jdk.internal.misc.Unsafeif available. | 
| protected  | Factory(ClassInjector.UsingUnsafe.Dispatcher.Initializable dispatcher)Creates a new factory. | 
|   | Factory(ClassInjector.UsingUnsafe.Factory.AccessResolver accessResolver)Creates a new factory for an unsafe class injector. | 
| Modifier and Type | Method and Description | 
|---|---|
| boolean | isAvailable()Returns  trueif this factory creates a valid dispatcher. | 
| ClassInjector | make(ClassLoader classLoader)Creates a new class injector for the given class loader without a  ProtectionDomain. | 
| ClassInjector | make(ClassLoader classLoader,
    ProtectionDomain protectionDomain)Creates a new class injector for the given class loader and protection domain. | 
| static ClassInjector.UsingUnsafe.Factory | resolve(Instrumentation instrumentation)Resolves an injection strategy that uses unsafe injection if available and also attempts to open and use
  jdk.internal.misc.Unsafeas a fallback. | 
| static ClassInjector.UsingUnsafe.Factory | resolve(Instrumentation instrumentation,
       boolean local)Resolves an injection strategy that uses unsafe injection if available and also attempts to open and use
  jdk.internal.misc.Unsafeas a fallback. | 
public Factory()
jdk.internal.misc.Unsafe if available.public Factory(ClassInjector.UsingUnsafe.Factory.AccessResolver accessResolver)
accessResolver - The access resolver to use.protected Factory(ClassInjector.UsingUnsafe.Dispatcher.Initializable dispatcher)
dispatcher - The dispatcher to use.public static ClassInjector.UsingUnsafe.Factory resolve(Instrumentation instrumentation)
jdk.internal.misc.Unsafe as a fallback. This method generates a new class and module for opening the
 internal package to avoid its exposure to any non-trusted code.instrumentation - The instrumentation instance to use for opening the internal package if required.public static ClassInjector.UsingUnsafe.Factory resolve(Instrumentation instrumentation, boolean local)
jdk.internal.misc.Unsafe as a fallback.instrumentation - The instrumentation instance to use for opening the internal package if required.local - false if a new class should in a separated class loader and module should be created for
                        opening the jdk.internal.misc package. This way, the internal package is not exposed to any
                        other classes within this class's module.public boolean isAvailable()
true if this factory creates a valid dispatcher.true if this factory creates a valid dispatcher.public ClassInjector make(ClassLoader classLoader)
ProtectionDomain.classLoader - The class loader to inject into or null to inject into the bootstrap loader.public ClassInjector make(ClassLoader classLoader, ProtectionDomain protectionDomain)
classLoader - The class loader to inject into or null to inject into the bootstrap loader.protectionDomain - The protection domain to apply or null if no protection domain should be used.Copyright © 2014–2021. All rights reserved.