1 17 package org.apache.geronimo.gbean.runtime; 18 19 import java.lang.reflect.Method ; 20 import java.lang.reflect.InvocationTargetException ; 21 22 25 public final class ReflectionMethodInvoker implements MethodInvoker { 26 private final Method method; 27 28 public ReflectionMethodInvoker(Method method) { 29 this.method = method; 30 } 31 32 public Object invoke(final Object target, final Object [] arguments) throws Exception { 33 try { 34 return method.invoke(target, arguments); 35 } catch (InvocationTargetException e) { 36 Throwable cause = e.getTargetException(); 37 if (cause instanceof Exception ) { 38 throw (Exception ) cause; 39 } else if (cause instanceof Error ) { 40 throw (Error ) cause; 41 } 42 throw e; 43 } 44 } 45 } 46 | Popular Tags |