Package org.jboss.classfilewriter
Class ClassFile
java.lang.Object
org.jboss.classfilewriter.ClassFile
- All Implemented Interfaces:
WritableEntry
- Author:
- Stuart Douglas, Richard Opalka
-
Constructor Summary
ConstructorsConstructorDescriptionClassFile
(String name, int accessFlags, String superclass, int version, ClassLoader classLoader, String... interfaces) Deprecated.ClassFile
(String name, int accessFlags, String superclass, int version, ClassLoader classLoader, ClassFactory classFactory, String... interfaces) ClassFile
(String name, int accessFlags, String superclass, ClassLoader classLoader, String... interfaces) Deprecated.ClassFile
(String name, int accessFlags, String superclass, ClassLoader classLoader, ClassFactory classFactory, String... interfaces) Deprecated.ClassFile
(String name, String superclass, ClassLoader classLoader, String... interfaces) Deprecated.ClassFile
(String name, String superclass, ClassLoader classLoader, ClassFactory classFactory, String... interfaces) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionaddConstructor
(Constructor<?> method) Adds a constructor with the same signiture as the given constrcutor, including exception typesAdds a field with the given name and descriptor.void
addInterface
(String iface) Adds a method with the same signiture as the given method, including exception typesClass
<?> define()
Class
<?> define
(ClassLoader loader) Deprecated.Class
<?> define
(ClassLoader loader, ProtectionDomain domain) Deprecated.Class
<?> define
(ProtectionDomain domain) returns the type descriptor for the classgetName()
Returns the generated class namebyte[]
void
write
(ByteArrayDataOutputStream stream)
-
Constructor Details
-
ClassFile
Deprecated. -
ClassFile
Deprecated. -
ClassFile
@Deprecated public ClassFile(String name, String superclass, ClassLoader classLoader, String... interfaces) Deprecated. -
ClassFile
@Deprecated public ClassFile(String name, int accessFlags, String superclass, ClassLoader classLoader, String... interfaces) Deprecated. -
ClassFile
@Deprecated public ClassFile(String name, int accessFlags, String superclass, int version, ClassLoader classLoader, String... interfaces) Deprecated. -
ClassFile
public ClassFile(String name, String superclass, ClassLoader classLoader, ClassFactory classFactory, String... interfaces) -
ClassFile
public ClassFile(String name, int accessFlags, String superclass, ClassLoader classLoader, ClassFactory classFactory, String... interfaces) -
ClassFile
public ClassFile(String name, int accessFlags, String superclass, int version, ClassLoader classLoader, ClassFactory classFactory, String... interfaces)
-
-
Method Details
-
addInterface
-
addField
Adds a field with the given name and descriptor. -
addField
-
addField
-
addField
-
addField
-
addMethod
-
addMethod
Adds a method with the same signiture as the given method, including exception typesThe new method will have the same modifier as the original method, except that the abstract and native flags will be stripped.
TODO: annotations and signiture attribute
-
addConstructor
Adds a constructor with the same signiture as the given constrcutor, including exception typesTODO: annotations and signiture attribute
-
write
- Specified by:
write
in interfaceWritableEntry
- Throws:
IOException
-
define
-
define
Deprecated. -
define
-
define
Deprecated.Definines the class using the given ClassLoader and ProtectionDomain -
toBytecode
public byte[] toBytecode() -
getClassLoader
-
getConstPool
-
getDescriptor
returns the type descriptor for the class- Returns:
-
getRuntimeVisibleAnnotationsAttribute
-
getName
Returns the generated class name- Returns:
- The generated class name
-
getSuperclass
- Returns:
- The generated superclass name
-
getInterfaces
- Returns:
- The interfaces implemented by this class
-
getFields
- Returns:
- This class's fields
-
getMethods
- Returns:
- This classes methods
-