classFab.addField(CREATOR_FIELD, PRIVATE_FINAL, ObjectCreator.class);
classFab.addConstructor(new Class[] { String.class, ObjectCreator.class }, null,
String.format("{ %s = $1; %s = $2; }", DESCRIPTION_FIELD, CREATOR_FIELD));
MethodSignature sig = new MethodSignature(interfaceType, DELEGATE_METHOD, null, null);
classFab.addMethod(Modifier.PRIVATE, sig, String.format("return ($r) %s.createObject();", CREATOR_FIELD));
MethodIterator mi = new MethodIterator(interfaceType);
while (mi.hasNext())
{
sig = mi.next();
classFab.addMethod(Modifier.PUBLIC, sig,
String.format("return ($r) %s().%s($$);", DELEGATE_METHOD, sig.getName()));
}
if (!mi.getToString())
classFab.addMethod(Modifier.PUBLIC, toStringSignature, String.format("return %s;", DESCRIPTION_FIELD));