@HashCodeAndEqualsPlugin.Enhance public static class ClassInjector.UsingReflection.Dispatcher.UsingUnsafeInjection extends java.lang.Object implements ClassInjector.UsingReflection.Dispatcher, ClassInjector.UsingReflection.Dispatcher.Initializable
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 |
---|---|
private java.lang.Object |
accessor
An instance of the accessor class that is required for using it's intentionally non-static methods.
|
private java.lang.reflect.Method |
defineClass
The accessor method for using
ClassLoader.defineClass(String, byte[], int, int, ProtectionDomain) . |
private java.lang.reflect.Method |
definePackage
The accessor method for using
ClassLoader.definePackage(String, String, String, String, String, String, String, URL) . |
private java.lang.reflect.Method |
findLoadedClass
The accessor method for using
ClassLoader.findLoadedClass(String) . |
private java.lang.reflect.Method |
getClassLoadingLock
The accessor method for using
ClassLoader#getClassLoadingLock(String) or returning the supplied ClassLoader
if this method does not exist on the current VM. |
private java.lang.reflect.Method |
getPackage
The accessor method for using
ClassLoader.getPackage(String) or ClassLoader#getDefinedPackage(String) . |
UNDEFINED
Modifier | Constructor and Description |
---|---|
protected |
UsingUnsafeInjection(java.lang.Object accessor,
java.lang.reflect.Method findLoadedClass,
java.lang.reflect.Method defineClass,
java.lang.reflect.Method getPackage,
java.lang.reflect.Method definePackage,
java.lang.reflect.Method getClassLoadingLock)
Creates a new class loading injection dispatcher using an unsafe injected dispatcher.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Class<?> |
defineClass(java.lang.ClassLoader classLoader,
java.lang.String name,
byte[] binaryRepresentation,
java.security.ProtectionDomain protectionDomain)
Defines a class for the given class loader.
|
java.lang.Package |
definePackage(java.lang.ClassLoader classLoader,
java.lang.String name,
java.lang.String specificationTitle,
java.lang.String specificationVersion,
java.lang.String specificationVendor,
java.lang.String implementationTitle,
java.lang.String implementationVersion,
java.lang.String implementationVendor,
java.net.URL sealBase)
Defines a package for the given class loader.
|
java.lang.Class<?> |
findClass(java.lang.ClassLoader classLoader,
java.lang.String name)
Looks up a class from the given class loader.
|
java.lang.Object |
getClassLoadingLock(java.lang.ClassLoader classLoader,
java.lang.String name)
Returns the lock for loading the specified class.
|
java.lang.Package |
getPackage(java.lang.ClassLoader classLoader,
java.lang.String name)
Looks up a package from a class loader.
|
ClassInjector.UsingReflection.Dispatcher |
initialize()
Initializes this dispatcher.
|
boolean |
isAvailable()
Indicates if this dispatcher is available.
|
protected static ClassInjector.UsingReflection.Dispatcher.Initializable |
make()
Creates an indirect dispatcher.
|
private final java.lang.Object accessor
private final java.lang.reflect.Method findLoadedClass
ClassLoader.findLoadedClass(String)
.private final java.lang.reflect.Method defineClass
ClassLoader.defineClass(String, byte[], int, int, ProtectionDomain)
.private final java.lang.reflect.Method getPackage
ClassLoader.getPackage(String)
or ClassLoader#getDefinedPackage(String)
.private final java.lang.reflect.Method definePackage
ClassLoader.definePackage(String, String, String, String, String, String, String, URL)
.private final java.lang.reflect.Method getClassLoadingLock
ClassLoader#getClassLoadingLock(String)
or returning the supplied ClassLoader
if this method does not exist on the current VM.protected UsingUnsafeInjection(java.lang.Object accessor, java.lang.reflect.Method findLoadedClass, java.lang.reflect.Method defineClass, java.lang.reflect.Method getPackage, java.lang.reflect.Method definePackage, java.lang.reflect.Method getClassLoadingLock)
accessor
- An instance of the accessor class that is required for using it's intentionally non-static methods.findLoadedClass
- An instance of ClassLoader.findLoadedClass(String)
.defineClass
- An instance of ClassLoader.defineClass(String, byte[], int, int, ProtectionDomain)
.getPackage
- An instance of ClassLoader.getPackage(String)
or ClassLoader#getDefinedPackage(String)
.definePackage
- An instance of ClassLoader.definePackage(String, String, String, String, String, String, String, URL)
.getClassLoadingLock
- The accessor method for using ClassLoader#getClassLoadingLock(String)
or returning the
supplied ClassLoader
if this method does not exist on the current VM.protected static ClassInjector.UsingReflection.Dispatcher.Initializable make() throws java.lang.Exception
java.lang.Exception
- If the dispatcher 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 java.lang.Object getClassLoadingLock(java.lang.ClassLoader classLoader, java.lang.String name)
getClassLoadingLock
in interface ClassInjector.UsingReflection.Dispatcher
classLoader
- the class loader to inject the class into.name
- The name of the class.public java.lang.Class<?> findClass(java.lang.ClassLoader classLoader, java.lang.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 java.lang.Class<?> defineClass(java.lang.ClassLoader classLoader, java.lang.String name, byte[] binaryRepresentation, java.security.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.public java.lang.Package getPackage(java.lang.ClassLoader classLoader, java.lang.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 java.lang.Package definePackage(java.lang.ClassLoader classLoader, java.lang.String name, java.lang.String specificationTitle, java.lang.String specificationVersion, java.lang.String specificationVendor, java.lang.String implementationTitle, java.lang.String implementationVersion, java.lang.String implementationVendor, java.net.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.