|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.hivemind.service.impl.AbstractFab org.apache.hivemind.service.impl.ClassFabImpl
public class ClassFabImpl
Implementation of ClassFab
. Hides, as much as possible, the
underlying library (Javassist).
Constructor Summary | |
---|---|
ClassFabImpl(CtClassSource source,
javassist.CtClass ctClass)
|
Method Summary | |
---|---|
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. |
Methods inherited from class org.apache.hivemind.service.impl.AbstractFab |
---|
addInterface, canConvert, convertClass, convertClasses, createClass, getCtClass, getSource |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.hivemind.service.ClassFab |
---|
addInterface, canConvert, createClass |
Constructor Detail |
---|
public ClassFabImpl(CtClassSource source, javassist.CtClass ctClass)
Method Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public void addField(java.lang.String name, java.lang.Class type)
ClassFab
addField
in interface ClassFab
public boolean containsMethod(MethodSignature ms)
ClassFab
containsMethod
in interface ClassFab
ms
- the signature
public MethodFab addMethod(int modifiers, MethodSignature ms, java.lang.String body)
ClassFab
addMethod
in interface ClassFab
modifiers
- Modifiers for the method (see Modifier
).ms
- defines the name, return type, parameters and exceptions thrownbody
- The body of the method.
public MethodFab getMethodFab(MethodSignature ms)
ClassFab
getMethodFab
in interface ClassFab
ms
- the signature of the method previously added
public void addConstructor(java.lang.Class[] parameterTypes, java.lang.Class[] exceptions, java.lang.String body)
ClassFab
addConstructor
in interface ClassFab
parameterTypes
- 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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |