public class ClassFabImpl extends AbstractFab implements ClassFab
ClassFab. Hides, as much as possible, the
underlying library (Javassist).| Constructor and Description |
|---|
ClassFabImpl(CtClassSource source,
javassist.CtClass ctClass) |
| Modifier and Type | Method and Description |
|---|---|
void |
addConstructor(java.lang.Class[] parameterTypes,
java.lang.Class[] exceptions,
java.lang.String body)
Adds a constructor to the class.
|
void |
addField(java.lang.String name,
java.lang.Class type)
Adds a new field with the given name and type.
|
MethodFab |
addMethod(int modifiers,
MethodSignature ms,
java.lang.String body)
Adds a method.
|
boolean |
containsMethod(MethodSignature ms)
Convenience method for checking whether the fabricated class already contains
a method.
|
MethodFab |
getMethodFab(MethodSignature ms)
Returns a previous defined method so that it can be further enhanced
(perhaps by adding additional catches, etc.).
|
java.lang.String |
toString()
Returns a representation of the fabricated class, including inheritance, fields,
constructors, methods and method bodies.
|
addInterface, convertClass, convertClasses, createClass, getCtClass, getSourceclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddInterface, createClasspublic ClassFabImpl(CtClassSource source, javassist.CtClass ctClass)
public java.lang.String toString()
toString in class java.lang.Objectpublic void addField(java.lang.String name, java.lang.Class type)
ClassFabpublic boolean containsMethod(MethodSignature ms)
ClassFabcontainsMethod in interface ClassFabms - the signaturepublic MethodFab addMethod(int modifiers, MethodSignature ms, java.lang.String body)
ClassFabpublic MethodFab getMethodFab(MethodSignature ms)
ClassFabgetMethodFab in interface ClassFabms - the signature of the method previously addedpublic void addConstructor(java.lang.Class[] parameterTypes, java.lang.Class[] exceptions, java.lang.String body)
ClassFabaddConstructor in interface ClassFabparameterTypes - the type of each parameter, or null if the constructor takes no parameters.exceptions - the type of each exception, or null if the constructor throws no exceptions.body - The body of the constructor.