public static Object invokeMethod(Object object, String methodName, Class<?>[] parameterTypes,
                                      Object[] parameters) throws NoSuchMethodException, InvocationTargetException,
            IllegalAccessException {
        if (Checker.isEmpty(parameters)) {
            return object.getClass().getMethod(methodName).invoke(object);
        } else {
            return object.getClass().getMethod(methodName, parameterTypes).invoke(object, parameters);
        }
    }
public static Object invokeMethod ( Object object , String methodName , Class < ? > [ ] parameterTypes , Object [ ] parameters ) throws NoSuchMethodException , InvocationTargetException , IllegalAccessException { if ( Checker . isEmpty ( parameters ) ) { return object . getClass ( ) . getMethod ( methodName ) . invoke ( object ) ; } else { return object . getClass ( ) . getMethod ( methodName , parameterTypes ) . invoke ( object , parameters ) ; } }
调用方法

@param object 对象
@param methodName 方法名
@param parameterTypes 参数类型
@param parameters 参数

@return 方法返回的结果

@throws NoSuchMethodException 异常
@throws InvocationTargetException 异常
@throws IllegalAccessException 异常