|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.hivemind.service.impl.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. |
void |
addInterface(java.lang.Class interfaceClass)
Adds the specified interface as an interface implemented by this class. |
MethodFab |
addMethod(int modifiers,
MethodSignature ms,
java.lang.String body)
Adds a method. |
java.lang.Class |
createClass()
Invoked last to create the class. |
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ClassFabImpl(CtClassSource source, javassist.CtClass ctClass)
Method Detail |
public java.lang.String toString()
toString
in class java.lang.Object
public void addInterface(java.lang.Class interfaceClass)
ClassFab
addInterface
in interface ClassFab
public void addField(java.lang.String name, java.lang.Class type)
ClassFab
addField
in interface ClassFab
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.public java.lang.Class createClass()
ClassFab
createClass
in interface ClassFab
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |