System.out.println("ptype="+propertyType.getName()); System.out.println(" val="+((val==null)?"null":val.toString()));
  public Object invoke(Object proxy, Method method, Object[] arguments)    throws Exception  {    // Do we actually need the proxy?    if (method == null)      throw new RuntimeException("Invoking null method");    // Listener methods that weren't specified are ignored.  If listenerMethod    // is null, then all listener methods are processed.    if (listenerMethod != null && !method.getName().equals(listenerMethod))      return null;    // Extract the first arg from arguments and do getProperty on arg    if (arguments == null || arguments.length == 0)      return null;    Object event = arguments[0]; // We hope :-)    // Obtain the property XXX propertyType keeps showing up null - why?    // because the object inside getProperty changes, but the ref variable    // can't change this way, dolt!  need a better way to get both values out    // - need method and object to do the invoke and get return type    Object v[] = getProperty(event, property);    Object val = v[0];    Class propertyType = (Class) v[1];    System.out.println("ptype="+propertyType.getName());    System.out.println(" val="+((val==null)?"null":val.toString()));        // Find the actual method of target to invoke.  We can't do this in the    // constructor since we don't know the type of the property we extracted    // from the event then.    //    // action can be either a property or a method.  Sun's docs seem to imply    // that action should be treated as a property first, and then a method,    // but don't specifically say it.    //    // XXX check what happens with native type wrappers.  The better thing to    // do is look at the return type of the method    Method actionMethod;    try      {	// Look for a property setter for action.	actionMethod = 	  target.getClass().getMethod("set" + capitalize(action),				      new Class[] {propertyType});      }    catch (NoSuchMethodException e)      {	// If action as property didn't work, try as method.	try	  {	    actionMethod = 	      target.getClass().getMethod(action, new Class[] {propertyType});	  }	catch (NoSuchMethodException e1)	  {	    // When event property is null, we may call action with no args	    if (property == null)	      {		actionMethod =		  target.getClass().getMethod(action, null);		return actionMethod.invoke(target, null);	      }	    else	      throw e1;	  }      }    // Invoke target.action(property)    return actionMethod.invoke(target, new Object[] {val});  }