diff --git a/pom.xml b/pom.xml index 6e964da..d661366 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ com.iflytop uf - 0.0.63 + 0.0.64 uf uf diff --git a/src/main/java/com/iflytop/uf/util/UfClassHelper.java b/src/main/java/com/iflytop/uf/util/UfClassHelper.java index 256f51f..6654901 100644 --- a/src/main/java/com/iflytop/uf/util/UfClassHelper.java +++ b/src/main/java/com/iflytop/uf/util/UfClassHelper.java @@ -40,25 +40,19 @@ public class UfClassHelper { } // invoke method - public static Object invokeMethod(Object obj, String methodName, List args) throws NoSuchMethodException { - try { - Class[] parameterTypes = new Class[args.size()]; - for (int i = 0; i < args.size(); i++) { - parameterTypes[i] = args.get(i).getClass(); - } - Method method = obj.getClass().getMethod(methodName, parameterTypes); + public static Object invokeMethod(Object obj, String methodName, List args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { + Class[] parameterTypes = new Class[args.size()]; + for (int i = 0; i < args.size(); i++) { + parameterTypes[i] = args.get(i).getClass(); + } + Method method = obj.getClass().getMethod(methodName, parameterTypes); - if ( method.getReturnType().equals(Void.TYPE) ) { - method.invoke(obj, args.toArray()); - return null; - } else { - return method.invoke(obj, args.toArray()); - } - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } catch ( InvocationTargetException e ) { - throw new RuntimeException(e.getCause().getMessage()); - } + if ( method.getReturnType().equals(Void.TYPE) ) { + method.invoke(obj, args.toArray()); + return null; + } else { + return method.invoke(obj, args.toArray()); + } } // get all classes in package