public static Object getField(Class senderClass, Object receiver, String messageName) throws Throwable { try { return InvokerHelper.getAttribute(receiver, messageName); } catch (GroovyRuntimeException gre) { throw unwrap(gre); } }
public static Object getFieldOnSuper(Class senderClass, Object receiver, String messageName) throws Throwable { try { if (receiver instanceof Class) { return InvokerHelper.getAttribute(receiver, messageName); } else { MetaClass mc = ((GroovyObject) receiver).getMetaClass(); return mc.getAttribute(senderClass, receiver, messageName, true); } } catch (GroovyRuntimeException gre) { throw unwrap(gre); } }