{
_lock.check();
addInterface(serviceInterface);
MethodIterator mi = new MethodIterator(serviceInterface);
while (mi.hasNext())
{
MethodSignature sig = mi.next();
// ($r) properly handles void methods for us, which keeps this simple.
String body = format("return ($r) %s.%s($$);", delegateExpression, sig.getName());
addMethod(Modifier.PUBLIC, sig, body);
}
if (!mi.getToString()) addToString(toString);
}