예제 #1
0
 public static void setProperty(
     Object messageArgument, Class senderClass, Object receiver, String messageName)
     throws Throwable {
   try {
     if (receiver == null) receiver = NullObject.getNullObject();
     InvokerHelper.setProperty(receiver, messageName, messageArgument);
   } catch (GroovyRuntimeException gre) {
     throw unwrap(gre);
   }
 }
예제 #2
0
 /**
  * Provides a hook for type coercion of the given object to the required type
  *
  * @param type of object to convert the given object to
  * @param object the object to be converted
  * @return the original object or a new converted value
  * @throws Throwable if the coercion fails
  */
 public static Object asType(Object object, Class type) throws Throwable {
   if (object == null) object = NullObject.getNullObject();
   return invokeMethodN(object.getClass(), object, "asType", new Object[] {type});
 }