- java.lang.Object
-
- org.jboss.modules.ClassDefiner
-
public final class ClassDefiner extends 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 Class<?>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 ClassDefinergetInstance()Get the class definer instance.
-
-
-
Method Detail
-
defineClass
public Class<?> defineClass(Class<?> originalClass, String className, 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 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 theclassBytesarraylen- the number of bytes to use from theclassBytesarray- Returns:
- the defined class (not
null)
-
defineClass
public Class<?> defineClass(Class<?> originalClass, 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 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 theclassBytesarraylen- the number of bytes to use from theclassBytesarray- 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 theclassBytesarraylen- the number of bytes to use from theclassBytesarray- 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
public static ClassDefiner getInstance()
Get the class definer instance. The caller must have thecreateClassLoaderRuntimePermission.- Returns:
- the singleton class definer instance (not
null)
-
-