429 public Object run() {
430 return invokeInternal(proxy, method, arguments);
431 }
432 }, acc);
433 }
434
435 private Object invokeInternal(Object proxy, Method method, Object[] arguments) {
436 String methodName = method.getName();
437 if (method.getDeclaringClass() == Object.class) {
438 // Handle the Object public methods.
439 if (methodName.equals("hashCode")) {
440 return new Integer(System.identityHashCode(proxy));
441 } else if (methodName.equals("equals")) {
442 return (proxy == arguments[0] ? Boolean.TRUE : Boolean.FALSE);
443 } else if (methodName.equals("toString")) {
444 return proxy.getClass().getName() + '@' + Integer.toHexString(proxy.hashCode());
445 }
446 }
447
448 if (listenerMethodName == null || listenerMethodName.equals(methodName)) {
449 Class[] argTypes = null;
450 Object[] newArgs = null;
451
452 if (eventPropertyName == null) { // Nullary method.
453 newArgs = new Object[]{};
454 argTypes = new Class<?>[]{};
455 }
456 else {
457 Object input = applyGetters(arguments[0], getEventPropertyName());
458 newArgs = new Object[]{input};
459 argTypes = new Class<?>[]{input == null ? null :
460 input.getClass()};
461 }
462 try {
463 int lastDot = action.lastIndexOf('.');
464 if (lastDot != -1) {
465 target = applyGetters(target, action.substring(0, lastDot));
466 action = action.substring(lastDot + 1);
467 }
468 Method targetMethod = Statement.getMethod(
469 target.getClass(), action, argTypes);
|
429 public Object run() {
430 return invokeInternal(proxy, method, arguments);
431 }
432 }, acc);
433 }
434
435 private Object invokeInternal(Object proxy, Method method, Object[] arguments) {
436 String methodName = method.getName();
437 if (method.getDeclaringClass() == Object.class) {
438 // Handle the Object public methods.
439 if (methodName.equals("hashCode")) {
440 return new Integer(System.identityHashCode(proxy));
441 } else if (methodName.equals("equals")) {
442 return (proxy == arguments[0] ? Boolean.TRUE : Boolean.FALSE);
443 } else if (methodName.equals("toString")) {
444 return proxy.getClass().getName() + '@' + Integer.toHexString(proxy.hashCode());
445 }
446 }
447
448 if (listenerMethodName == null || listenerMethodName.equals(methodName)) {
449 Class<?>[] argTypes = null;
450 Object[] newArgs = null;
451
452 if (eventPropertyName == null) { // Nullary method.
453 newArgs = new Object[]{};
454 argTypes = new Class<?>[]{};
455 }
456 else {
457 Object input = applyGetters(arguments[0], getEventPropertyName());
458 newArgs = new Object[]{input};
459 argTypes = new Class<?>[]{input == null ? null :
460 input.getClass()};
461 }
462 try {
463 int lastDot = action.lastIndexOf('.');
464 if (lastDot != -1) {
465 target = applyGetters(target, action.substring(0, lastDot));
466 action = action.substring(lastDot + 1);
467 }
468 Method targetMethod = Statement.getMethod(
469 target.getClass(), action, argTypes);
|