Top Description Fields Constructors Methods
org.jboss.classfilewriter

pack-priv final Class DefaultClassFactory

extends Object
implements ClassFactory
Class Inheritance
All Implemented Interfaces
org.jboss.classfilewriter.ClassFactory
Imports
java.lang.invoke.MethodHandle, .MethodHandles, .MethodType, java.security.AccessController, .PrivilegedExceptionAction, .ProtectionDomain

Default class definition factory.
Author
Richard Opalka

Field Summary

Modifier and TypeField and Description
private static final String
private static final MethodHandle
private static final MethodHandle
pack-priv static final ClassFactory

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public Class<?>
defineClass(final ClassLoader
The classloader to be used for class definition.
loader
,
final String
The expected binary name of the class, or null if not known
name
,
final byte[]
The bytes that make up the class data. The bytes in positions off through off+len-1 should have the format of a valid class file as defined by The Java™ Virtual Machine Specification.
b
,
final int
The start offset in b of the class data
off
,
final int
The length of the class data
len
,
final ProtectionDomain
The ProtectionDomain of the class
domain
)

Implements org.jboss.classfilewriter.ClassFactory.defineClass.

Converts an array of bytes into an instance of class Class.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFINE_CLASS_METHOD_NAMEback to summary
private static final String DEFINE_CLASS_METHOD_NAME
defineClassWithDomainParamback to summary
private static final MethodHandle defineClassWithDomainParam
defineClassWithoutDomainParamback to summary
private static final MethodHandle defineClassWithoutDomainParam
INSTANCEback to summary
pack-priv static final ClassFactory INSTANCE

Constructor Detail

DefaultClassFactoryback to summary
private DefaultClassFactory()

Method Detail

defineClassback to summary
public Class<?> defineClass(final ClassLoader loader, final String name, final byte[] b, final int off, final int len, final ProtectionDomain domain) throws ClassFormatError

Implements org.jboss.classfilewriter.ClassFactory.defineClass.

Doc from org.jboss.classfilewriter.ClassFactory.defineClass.

Converts an array of bytes into an instance of class Class.

Parameters
loader:ClassLoader

The classloader to be used for class definition.

name:String

The expected binary name of the class, or null if not known

b:byte[]

The bytes that make up the class data. The bytes in positions off through off+len-1 should have the format of a valid class file as defined by The Java™ Virtual Machine Specification.

off:int

The start offset in b of the class data

len:int

The length of the class data

domain:ProtectionDomain

The ProtectionDomain of the class

Returns:Class<?>

The Class object that was created from the specified class data.

Annotations
@Override
Exceptions
ClassFormatError:
If the data did not contain a valid class