Package org.jboss.modules
Class ClassDefiner
- java.lang.Object
-
- org.jboss.modules.ClassDefiner
-
public final class ClassDefiner extends java.lang.Object
A hook for frameworks which need to define additional classes to a module's class loader.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Class<?>
defineClass(java.lang.Class<?> originalClass, java.lang.String className, byte[] classBytes)
Define a class using the module and protection domain of an existing class.java.lang.Class<?>
defineClass(java.lang.Class<?> originalClass, java.lang.String className, byte[] classBytes, int off, int len)
Define a class using the module and protection domain of an existing class.java.lang.Class<?>
defineClass(java.lang.Class<?> originalClass, java.lang.String className, java.nio.ByteBuffer classBytes)
Define a class using the module and protection domain of an existing class.java.lang.Class<?>
defineClass(java.lang.Class<?> originalClass, java.lang.String className, java.security.ProtectionDomain protectionDomain, byte[] classBytes)
Define a class using the module of an existing class.java.lang.Class<?>
defineClass(java.lang.Class<?> originalClass, java.lang.String className, java.security.ProtectionDomain protectionDomain, byte[] classBytes, int off, int len)
Define a class using the module of an existing class.java.lang.Class<?>
defineClass(java.lang.Class<?> originalClass, java.lang.String className, java.security.ProtectionDomain protectionDomain, java.nio.ByteBuffer classBytes)
Define a class using the module of an existing class.java.lang.Class<?>
defineClass(Module module, java.lang.String className, java.security.ProtectionDomain protectionDomain, byte[] classBytes)
Define a class.java.lang.Class<?>
defineClass(Module module, java.lang.String className, java.security.ProtectionDomain protectionDomain, byte[] classBytes, int off, int len)
Define a class.java.lang.Class<?>
defineClass(Module module, java.lang.String className, java.security.ProtectionDomain protectionDomain, java.nio.ByteBuffer classBytes)
Define a class.static ClassDefiner
getInstance()
Get the class definer instance.
-
-
-
Method Detail
-
defineClass
public java.lang.Class<?> defineClass(java.lang.Class<?> originalClass, java.lang.String className, java.nio.ByteBuffer classBytes)
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 java.lang.Class<?> defineClass(java.lang.Class<?> originalClass, java.lang.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
public java.lang.Class<?> defineClass(java.lang.Class<?> originalClass, java.lang.String className, byte[] classBytes)
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 java.lang.Class<?> defineClass(java.lang.Class<?> originalClass, java.lang.String className, java.security.ProtectionDomain protectionDomain, java.nio.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 java.lang.Class<?> defineClass(java.lang.Class<?> originalClass, java.lang.String className, java.security.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 java.lang.Class<?> defineClass(java.lang.Class<?> originalClass, java.lang.String className, java.security.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 java.lang.Class<?> defineClass(Module module, java.lang.String className, java.security.ProtectionDomain protectionDomain, java.nio.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 java.lang.Class<?> defineClass(Module module, java.lang.String className, java.security.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 java.lang.Class<?> defineClass(Module module, java.lang.String className, java.security.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
public static ClassDefiner getInstance()
Get the class definer instance. The caller must have thecreateClassLoader
RuntimePermission
.- Returns:
- the singleton class definer instance (not
null
)
-
-