svoid forwardSwappableFunctionToObject(O o, S swappableMethodName, O target) { forwardSwappableFunctionToObject(o, swappableMethodName, target, swappableMethodName); } svoid forwardSwappableFunctionToObject(O o, S swappableMethodName, O target, S methodNameOnTarget) { if (o == null || target == null) ret; Class type = fieldType(o, swappableMethodName); if (type == null) ret; // field doesn't exist S proxyMethodName = type == Runnable.class ? "run" : "get"; set(o, swappableMethodName, singleObjectMethodProxy2(type, target, proxyMethodName, methodNameOnTarget)); }