public abstract static class ClassInjector.UsingReflection.Dispatcher.UsingUnsafeOverride extends Object implements ClassInjector.UsingReflection.Dispatcher, ClassInjector.UsingReflection.Dispatcher.Initializable
sun.misc.Unsafe#putBoolean
to set the AccessibleObject
field
for making methods accessible.Modifier and Type | Class and Description |
---|---|
protected static class |
ClassInjector.UsingReflection.Dispatcher.UsingUnsafeOverride.ForJava7CapableVm
A resolved class dispatcher using unsafe field injection for a class injector on a VM running at least Java 7.
|
protected static class |
ClassInjector.UsingReflection.Dispatcher.UsingUnsafeOverride.ForLegacyVm
A resolved class dispatcher using unsafe field injection for a class injector prior to Java 7.
|
ClassInjector.UsingReflection.Dispatcher.CreationAction, ClassInjector.UsingReflection.Dispatcher.Direct, ClassInjector.UsingReflection.Dispatcher.Initializable, ClassInjector.UsingReflection.Dispatcher.Unavailable, ClassInjector.UsingReflection.Dispatcher.UsingUnsafeInjection, ClassInjector.UsingReflection.Dispatcher.UsingUnsafeOverride
ClassInjector.UsingReflection.Dispatcher.Initializable.Unavailable
Modifier and Type | Field and Description |
---|---|
protected Method |
defineClass
|
protected Method |
definePackage
|
protected Method |
findLoadedClass
An instance of
ClassLoader.findLoadedClass(String) . |
protected Method |
getDefinedPackage
An instance of
java.lang.ClassLoader#getDefinedPackage(String) . |
protected Method |
getPackage
An instance of
ClassLoader.getPackage(String) . |
UNDEFINED
Modifier | Constructor and Description |
---|---|
protected |
UsingUnsafeOverride(Method findLoadedClass,
Method defineClass,
Method getDefinedPackage,
Method getPackage,
Method definePackage)
Creates a new unsafe field injecting injection dispatcher.
|
Modifier and Type | Method and Description |
---|---|
Class<?> |
defineClass(ClassLoader classLoader,
String name,
byte[] binaryRepresentation,
ProtectionDomain protectionDomain)
Defines a class for the given class loader.
|
Package |
definePackage(ClassLoader classLoader,
String name,
String specificationTitle,
String specificationVersion,
String specificationVendor,
String implementationTitle,
String implementationVersion,
String implementationVendor,
URL sealBase)
Defines a package for the given class loader.
|
Class<?> |
findClass(ClassLoader classLoader,
String name)
Looks up a class from the given class loader.
|
Package |
getDefinedPackage(ClassLoader classLoader,
String name)
Looks up a package from a class loader.
|
Package |
getPackage(ClassLoader classLoader,
String name)
Looks up a package from a class loader or its ancestor.
|
ClassInjector.UsingReflection.Dispatcher |
initialize()
Initializes this dispatcher.
|
boolean |
isAvailable()
Indicates if this dispatcher is available.
|
protected static ClassInjector.UsingReflection.Dispatcher.Initializable |
make()
Creates a new initializable class injector using an unsafe field injection.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getClassLoadingLock
protected final Method findLoadedClass
ClassLoader.findLoadedClass(String)
.protected final Method defineClass
@MaybeNull protected final Method getDefinedPackage
java.lang.ClassLoader#getDefinedPackage(String)
. May be null
.protected final Method getPackage
ClassLoader.getPackage(String)
.protected final Method definePackage
protected UsingUnsafeOverride(Method findLoadedClass, Method defineClass, @MaybeNull Method getDefinedPackage, Method getPackage, Method definePackage)
findLoadedClass
- An instance of ClassLoader.findLoadedClass(String)
.defineClass
- An instance of ClassLoader.defineClass(String, byte[], int, int, ProtectionDomain)
.getDefinedPackage
- An instance of java.lang.ClassLoader#getDefinedPackage(String)
. May be null
.getPackage
- An instance of ClassLoader.getPackage(String)
.definePackage
- An instance of ClassLoader.definePackage(String, String, String, String, String, String, String, URL)
.protected static ClassInjector.UsingReflection.Dispatcher.Initializable make() throws Exception
Exception
- If the injector cannot be created.public boolean isAvailable()
isAvailable
in interface ClassInjector.UsingReflection.Dispatcher.Initializable
true
if this dispatcher is available.public ClassInjector.UsingReflection.Dispatcher initialize()
initialize
in interface ClassInjector.UsingReflection.Dispatcher.Initializable
public Class<?> findClass(ClassLoader classLoader, String name)
findClass
in interface ClassInjector.UsingReflection.Dispatcher
classLoader
- The class loader for which a class should be located.name
- The binary name of the class that should be located.null
if no such class is defined for the provided class loader.public Class<?> defineClass(ClassLoader classLoader, String name, byte[] binaryRepresentation, @MaybeNull ProtectionDomain protectionDomain)
defineClass
in interface ClassInjector.UsingReflection.Dispatcher
classLoader
- The class loader for which a new class should be defined.name
- The binary name of the class that should be defined.binaryRepresentation
- The binary representation of the class.protectionDomain
- The protection domain for the defined class.@MaybeNull public Package getDefinedPackage(ClassLoader classLoader, String name)
ClassInjector.UsingReflection.Dispatcher.getPackage(ClassLoader, String)
getDefinedPackage
in interface ClassInjector.UsingReflection.Dispatcher
classLoader
- The class loader to query.name
- The binary name of the package.null
if no such package exists.public Package getPackage(ClassLoader classLoader, String name)
getPackage
in interface ClassInjector.UsingReflection.Dispatcher
classLoader
- The class loader to query.name
- The binary name of the package.null
if no such package exists.public Package definePackage(ClassLoader classLoader, String name, @MaybeNull String specificationTitle, @MaybeNull String specificationVersion, @MaybeNull String specificationVendor, @MaybeNull String implementationTitle, @MaybeNull String implementationVersion, @MaybeNull String implementationVendor, @MaybeNull URL sealBase)
definePackage
in interface ClassInjector.UsingReflection.Dispatcher
classLoader
- The class loader for which a package is to be defined.name
- The binary name of the package.specificationTitle
- The specification title of the package or null
if no specification title exists.specificationVersion
- The specification version of the package or null
if no specification version exists.specificationVendor
- The specification vendor of the package or null
if no specification vendor exists.implementationTitle
- The implementation title of the package or null
if no implementation title exists.implementationVersion
- The implementation version of the package or null
if no implementation version exists.implementationVendor
- The implementation vendor of the package or null
if no implementation vendor exists.sealBase
- The seal base URL or null
if the package should not be sealed.Copyright © 2014–2025. All rights reserved.