static A singleObjectMethodProxy2(Class intrface, O object, S invokedMethodName, S targetMethodName) {
ret proxyFromInvocationHandler(intrface, new InvocationHandler {
public O invoke(O proxy, Method method, O[] args) {
S mname = method.getName();
ifdef singleObjectMethodProxy2_debug
print("Proxy method called: " + mname + " " + toList(args));
endifdef
if (mname.equals(invokedMethodName))
ret call(object, targetMethodName, unnull(args));
if (mname.equals("toString"))
ret "proxy for method " + targetMethodName;
null;
}
});
}