예제 #1
0
 public static Object getField(Class senderClass, Object receiver, String messageName)
     throws Throwable {
   try {
     return InvokerHelper.getAttribute(receiver, messageName);
   } catch (GroovyRuntimeException gre) {
     throw unwrap(gre);
   }
 }
예제 #2
0
 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);
   }
 }