|
|||||||||
| Home >> All >> org >> apache >> hivemind >> [ service overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.hivemind.service
Interface ClassFab

- public interface ClassFab
Used when fabricating a new class. Represents a wrapper around the Javassist library.
The core concept of Javassist is how method bodies (as well as constructor bodies, etc.) are specified ... as a very Java-like scripting language. The BodyBuilder class is very useful for assembling this method bodies. Details are available at the Javassist home page.
Method bodies look largely like Java. References to java classes must be fully qualified. Several special variables are used:
$0first parameter, equivalent tothisin Java code (and can't be used when creating a static method)$1, $2, ...actual parameters to the method$argsall the parameters as anObject[]$rthe return type of the method, typically used asreturn ($r) ....$ris valid with method that returnvoid. This also handles conversions between wrapper types and primitive types.$wconversion from primitive type to wrapper type, used as($w) foo()wherefoo()returns a primitive type and a wrapper type is needed
| 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 signature,
java.lang.String body)
Adds a method. |
boolean |
containsMethod(MethodSignature signature)
Convenience method for checking whether the fabricated class already contains a method. |
java.lang.Class |
createClass()
Invoked last to create the class. |
MethodFab |
getMethodFab(MethodSignature signature)
Returns a previous defined method so that it can be further enhanced (perhaps by adding additional catches, etc.). |
| Method Detail |
addInterface
public void addInterface(java.lang.Class interfaceClass)
- Adds the specified interface as an interface implemented by this class.
addField
public void addField(java.lang.String name, java.lang.Class type)
- Adds a new field with the given name and type. The field is
added as a private field.
containsMethod
public boolean containsMethod(MethodSignature signature)
- Convenience method for checking whether the fabricated class already contains
a method.
addMethod
public MethodFab addMethod(int modifiers, MethodSignature signature, java.lang.String body)
- Adds a method. The method is a public instance method.
getMethodFab
public MethodFab getMethodFab(MethodSignature signature)
- Returns a previous defined method so that it can be further enhanced
(perhaps by adding additional catches, etc.).
addConstructor
public void addConstructor(java.lang.Class[] parameterTypes, java.lang.Class[] exceptions, java.lang.String body)
- Adds a constructor to the class. The constructor will be public.
createClass
public java.lang.Class createClass()
- Invoked last to create the class. This will enforce that
all abstract methods have been implemented in the (concrete) class.
|
|||||||||
| Home >> All >> org >> apache >> hivemind >> [ service overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC