Package org.jboss.modules
Class ClassDefiner
java.lang.Object
org.jboss.modules.ClassDefiner
A hook for frameworks which need to define additional classes to a module's class loader.
-
Method Summary
Modifier and TypeMethodDescriptionClass<?>
defineClass
(Class<?> originalClass, String className, byte[] classBytes) Define a class using the module and protection domain of an existing class.Class<?>
defineClass
(Class<?> originalClass, String className, byte[] classBytes, int off, int len) Define a class using the module and protection domain of an existing class.Class<?>
defineClass
(Class<?> originalClass, String className, ByteBuffer classBytes) Define a class using the module and protection domain of an existing class.Class<?>
defineClass
(Class<?> originalClass, String className, ProtectionDomain protectionDomain, byte[] classBytes) Define a class using the module of an existing class.Class<?>
defineClass
(Class<?> originalClass, String className, ProtectionDomain protectionDomain, byte[] classBytes, int off, int len) Define a class using the module of an existing class.Class<?>
defineClass
(Class<?> originalClass, String className, ProtectionDomain protectionDomain, ByteBuffer classBytes) Define a class using the module of an existing class.Class<?>
defineClass
(Module module, String className, ProtectionDomain protectionDomain, byte[] classBytes) Define a class.Class<?>
defineClass
(Module module, String className, ProtectionDomain protectionDomain, byte[] classBytes, int off, int len) Define a class.Class<?>
defineClass
(Module module, String className, ProtectionDomain protectionDomain, ByteBuffer classBytes) Define a class.static ClassDefiner
Get the class definer instance.
-
Method Details
-
defineClass
Define a class using the module and protection domain of an existing class.- Parameters:
originalClass
- the existing class (must not benull
)className
- the new class name (must not benull
)classBytes
- the new class bytes (must not benull
)- Returns:
- the defined class (not
null
)
-
defineClass
public Class<?> defineClass(Class<?> originalClass, String className, byte[] classBytes, int off, int len) Define a class using the module and protection domain of an existing class.- Parameters:
originalClass
- the existing class (must not benull
)className
- the new class name (must not benull
)classBytes
- the new class bytes (must not benull
)off
- the offset into theclassBytes
arraylen
- the number of bytes to use from theclassBytes
array- Returns:
- the defined class (not
null
)
-
defineClass
Define a class using the module and protection domain of an existing class.- Parameters:
originalClass
- the existing class (must not benull
)className
- the new class name (must not benull
)classBytes
- the new class bytes (must not benull
)- Returns:
- the defined class (not
null
)
-
defineClass
public Class<?> defineClass(Class<?> originalClass, String className, ProtectionDomain protectionDomain, ByteBuffer classBytes) Define a class using the module of an existing class.- Parameters:
originalClass
- the existing class (must not benull
)className
- the new class name (must not benull
)protectionDomain
- the protection domain of the new class (must not benull
)classBytes
- the new class bytes (must not benull
)- Returns:
- the defined class (not
null
)
-
defineClass
public Class<?> defineClass(Class<?> originalClass, String className, ProtectionDomain protectionDomain, byte[] classBytes, int off, int len) Define a class using the module of an existing class.- Parameters:
originalClass
- the existing class (must not benull
)className
- the new class name (must not benull
)protectionDomain
- the protection domain of the new class (must not benull
)classBytes
- the new class bytes (must not benull
)off
- the offset into theclassBytes
arraylen
- the number of bytes to use from theclassBytes
array- Returns:
- the defined class (not
null
)
-
defineClass
public Class<?> defineClass(Class<?> originalClass, String className, ProtectionDomain protectionDomain, byte[] classBytes) Define a class using the module of an existing class.- Parameters:
originalClass
- the existing class (must not benull
)className
- the new class name (must not benull
)protectionDomain
- the protection domain of the new class (must not benull
)classBytes
- the new class bytes (must not benull
)- Returns:
- the defined class (not
null
)
-
defineClass
public Class<?> defineClass(Module module, String className, ProtectionDomain protectionDomain, ByteBuffer classBytes) Define a class.- Parameters:
module
- the module to define the class to (must not benull
)className
- the new class name (must not benull
)protectionDomain
- the protection domain of the new class (must not benull
)classBytes
- the new class bytes (must not benull
)- Returns:
- the defined class (not
null
)
-
defineClass
public Class<?> defineClass(Module module, String className, ProtectionDomain protectionDomain, byte[] classBytes, int off, int len) Define a class.- Parameters:
module
- the module to define the class to (must not benull
)className
- the new class name (must not benull
)protectionDomain
- the protection domain of the new class (must not benull
)classBytes
- the new class bytes (must not benull
)off
- the offset into theclassBytes
arraylen
- the number of bytes to use from theclassBytes
array- Returns:
- the defined class (not
null
)
-
defineClass
public Class<?> defineClass(Module module, String className, ProtectionDomain protectionDomain, byte[] classBytes) Define a class.- Parameters:
module
- the module to define the class to (must not benull
)className
- the new class name (must not benull
)protectionDomain
- the protection domain of the new class (must not benull
)classBytes
- the new class bytes (must not benull
)- Returns:
- the defined class (not
null
)
-
getInstance
Get the class definer instance. The caller must have thecreateClassLoader
RuntimePermission
.- Returns:
- the singleton class definer instance (not
null
)
-