Package org.jboss.classfilewriter
Class DefaultClassFactory
- java.lang.Object
-
- org.jboss.classfilewriter.DefaultClassFactory
-
- All Implemented Interfaces:
ClassFactory
final class DefaultClassFactory extends java.lang.Object implements ClassFactory
Default class definition factory.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringDEFINE_CLASS_METHOD_NAMEprivate static java.lang.invoke.MethodHandledefineClassWithDomainParamprivate static java.lang.invoke.MethodHandledefineClassWithoutDomainParam(package private) static ClassFactoryINSTANCE
-
Constructor Summary
Constructors Modifier Constructor Description privateDefaultClassFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Class<?>defineClass(java.lang.ClassLoader loader, java.lang.String name, byte[] b, int off, int len, java.security.ProtectionDomain domain)Converts an array of bytes into an instance of class Class.
-
-
-
Field Detail
-
DEFINE_CLASS_METHOD_NAME
private static final java.lang.String DEFINE_CLASS_METHOD_NAME
- See Also:
- Constant Field Values
-
defineClassWithoutDomainParam
private static final java.lang.invoke.MethodHandle defineClassWithoutDomainParam
-
defineClassWithDomainParam
private static final java.lang.invoke.MethodHandle defineClassWithDomainParam
-
INSTANCE
static final ClassFactory INSTANCE
-
-
Method Detail
-
defineClass
public java.lang.Class<?> defineClass(java.lang.ClassLoader loader, java.lang.String name, byte[] b, int off, int len, java.security.ProtectionDomain domain) throws java.lang.ClassFormatErrorDescription copied from interface:ClassFactoryConverts an array of bytes into an instance of class Class.- Specified by:
defineClassin interfaceClassFactory- Parameters:
loader- The classloader to be used for class definition.name- The expected binary name of the class, or null if not knownb- 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- The start offset in b of the class datalen- The length of the class datadomain- The ProtectionDomain of the class- Returns:
- The Class object that was created from the specified class data.
- Throws:
java.lang.ClassFormatError- If the data did not contain a valid class
-
-