/** * Invokes a method on the given object that expects multiple arguments. * * @param clazz class object to get the method from * @param obj object on which the method should be invoked. Can be {@code null} for static methods * @param method name of the method to invoke * @param argClasses "types" of the arguments * @param argObjects argument values * @return return value of the method * @throws Exception if any error occurs */ private static Object invoke( final Class<?> clazz, final Object obj, final String method, final Class<?>[] argClasses, final Object[] argObjects) throws Exception { return clazz.getMethod(method, argClasses).invoke(obj, argObjects); }