Top Description Fields Constructors Methods
org.jboss.modules

public final Class ClassDefiner

extends Object
Class Inheritance
Imports
java.nio.ByteBuffer, java.security.PrivilegedAction, .ProtectionDomain

A hook for frameworks which need to define additional classes to a module's class loader.

Field Summary

Modifier and TypeField and Description
private static final RuntimePermission
private static final ClassDefiner

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public Class<?>

Returns:

the defined class (not null)
defineClass
(Class<?>
the existing class (must not be null)
originalClass
,
String
the new class name (must not be null)
className
,
ByteBuffer
the new class bytes (must not be null)
classBytes
)

Define a class using the module and protection domain of an existing class.

public Class<?>

Returns:

the defined class (not null)
defineClass
(Class<?>
the existing class (must not be null)
originalClass
,
String
the new class name (must not be null)
className
,
byte[]
the new class bytes (must not be null)
classBytes
,
int
the offset into the classBytes array
off
,
int
the number of bytes to use from the classBytes array
len
)

Define a class using the module and protection domain of an existing class.

public Class<?>

Returns:

the defined class (not null)
defineClass
(Class<?>
the existing class (must not be null)
originalClass
,
String
the new class name (must not be null)
className
,
byte[]
the new class bytes (must not be null)
classBytes
)

Define a class using the module and protection domain of an existing class.

public Class<?>

Returns:

the defined class (not null)
defineClass
(Class<?>
the existing class (must not be null)
originalClass
,
String
the new class name (must not be null)
className
,
ProtectionDomain
the protection domain of the new class (must not be null)
protectionDomain
,
ByteBuffer
the new class bytes (must not be null)
classBytes
)

Define a class using the module of an existing class.

public Class<?>

Returns:

the defined class (not null)
defineClass
(Class<?>
the existing class (must not be null)
originalClass
,
String
the new class name (must not be null)
className
,
ProtectionDomain
the protection domain of the new class (must not be null)
protectionDomain
,
byte[]
the new class bytes (must not be null)
classBytes
,
int
the offset into the classBytes array
off
,
int
the number of bytes to use from the classBytes array
len
)

Define a class using the module of an existing class.

public Class<?>

Returns:

the defined class (not null)
defineClass
(Class<?>
the existing class (must not be null)
originalClass
,
String
the new class name (must not be null)
className
,
ProtectionDomain
the protection domain of the new class (must not be null)
protectionDomain
,
byte[]
the new class bytes (must not be null)
classBytes
)

Define a class using the module of an existing class.

public Class<?>

Returns:

the defined class (not null)
defineClass
(Module
the module to define the class to (must not be null)
module
,
String
the new class name (must not be null)
className
,
ProtectionDomain
the protection domain of the new class (must not be null)
protectionDomain
,
ByteBuffer
the new class bytes (must not be null)
classBytes
)

Define a class.

public Class<?>

Returns:

the defined class (not null)
defineClass
(Module
the module to define the class to (must not be null)
module
,
String
the new class name (must not be null)
className
,
ProtectionDomain
the protection domain of the new class (must not be null)
protectionDomain
,
byte[]
the new class bytes (must not be null)
classBytes
,
int
the offset into the classBytes array
off
,
int
the number of bytes to use from the classBytes array
len
)

Define a class.

public Class<?>

Returns:

the defined class (not null)
defineClass
(Module
the module to define the class to (must not be null)
module
,
String
the new class name (must not be null)
className
,
ProtectionDomain
the protection domain of the new class (must not be null)
protectionDomain
,
byte[]
the new class bytes (must not be null)
classBytes
)

Define a class.

public static ClassDefiner

Returns:

the singleton class definer instance (not null)
getInstance
()

Get the class definer instance.

private ProtectionDomain
getProtectionDomain(final Class<?> clazz)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

createClassLoaderPermissionback to summary
private static final RuntimePermission createClassLoaderPermission
instanceback to summary
private static final ClassDefiner instance

Constructor Detail

ClassDefinerback to summary
private ClassDefiner()

Method Detail

defineClassback to summary
public Class<?> defineClass(Class<?> originalClass, String className, ByteBuffer classBytes)

Define a class using the module and protection domain of an existing class.

Parameters
originalClass:Class<?>

the existing class (must not be null)

className:String

the new class name (must not be null)

classBytes:ByteBuffer

the new class bytes (must not be null)

Returns:Class<?>

the defined class (not null)

defineClassback to summary
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:Class<?>

the existing class (must not be null)

className:String

the new class name (must not be null)

classBytes:byte[]

the new class bytes (must not be null)

off:int

the offset into the classBytes array

len:int

the number of bytes to use from the classBytes array

Returns:Class<?>

the defined class (not null)

defineClassback to summary
public Class<?> defineClass(Class<?> originalClass, String className, byte[] classBytes)

Define a class using the module and protection domain of an existing class.

Parameters
originalClass:Class<?>

the existing class (must not be null)

className:String

the new class name (must not be null)

classBytes:byte[]

the new class bytes (must not be null)

Returns:Class<?>

the defined class (not null)

defineClassback to summary
public Class<?> defineClass(Class<?> originalClass, String className, ProtectionDomain protectionDomain, ByteBuffer classBytes)

Define a class using the module of an existing class.

Parameters
originalClass:Class<?>

the existing class (must not be null)

className:String

the new class name (must not be null)

protectionDomain:ProtectionDomain

the protection domain of the new class (must not be null)

classBytes:ByteBuffer

the new class bytes (must not be null)

Returns:Class<?>

the defined class (not null)

defineClassback to summary
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:Class<?>

the existing class (must not be null)

className:String

the new class name (must not be null)

protectionDomain:ProtectionDomain

the protection domain of the new class (must not be null)

classBytes:byte[]

the new class bytes (must not be null)

off:int

the offset into the classBytes array

len:int

the number of bytes to use from the classBytes array

Returns:Class<?>

the defined class (not null)

defineClassback to summary
public Class<?> defineClass(Class<?> originalClass, String className, ProtectionDomain protectionDomain, byte[] classBytes)

Define a class using the module of an existing class.

Parameters
originalClass:Class<?>

the existing class (must not be null)

className:String

the new class name (must not be null)

protectionDomain:ProtectionDomain

the protection domain of the new class (must not be null)

classBytes:byte[]

the new class bytes (must not be null)

Returns:Class<?>

the defined class (not null)

defineClassback to summary
public Class<?> defineClass(Module module, String className, ProtectionDomain protectionDomain, ByteBuffer classBytes)

Define a class.

Parameters
module:Module

the module to define the class to (must not be null)

className:String

the new class name (must not be null)

protectionDomain:ProtectionDomain

the protection domain of the new class (must not be null)

classBytes:ByteBuffer

the new class bytes (must not be null)

Returns:Class<?>

the defined class (not null)

defineClassback to summary
public Class<?> defineClass(Module module, String className, ProtectionDomain protectionDomain, byte[] classBytes, int off, int len)

Define a class.

Parameters
module:Module

the module to define the class to (must not be null)

className:String

the new class name (must not be null)

protectionDomain:ProtectionDomain

the protection domain of the new class (must not be null)

classBytes:byte[]

the new class bytes (must not be null)

off:int

the offset into the classBytes array

len:int

the number of bytes to use from the classBytes array

Returns:Class<?>

the defined class (not null)

defineClassback to summary
public Class<?> defineClass(Module module, String className, ProtectionDomain protectionDomain, byte[] classBytes)

Define a class.

Parameters
module:Module

the module to define the class to (must not be null)

className:String

the new class name (must not be null)

protectionDomain:ProtectionDomain

the protection domain of the new class (must not be null)

classBytes:byte[]

the new class bytes (must not be null)

Returns:Class<?>

the defined class (not null)

getInstanceback to summary
public static ClassDefiner getInstance()

Get the class definer instance. The caller must have the createClassLoader RuntimePermission.

Returns:ClassDefiner

the singleton class definer instance (not null)

getProtectionDomainback to summary
private ProtectionDomain getProtectionDomain(final Class<?> clazz)