Here you can find the source of invokeMethod(Method method, Object bean, Object[] values)
public static Object invokeMethod(Method method, Object bean, Object[] values) throws IllegalAccessException, InvocationTargetException
//package com.java2s; //License from project: Apache License import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class Main { /** This just catches and wraps IllegalArgumentException. */ public static Object invokeMethod(Method method, Object bean, Object[] values) throws IllegalAccessException, InvocationTargetException { try {/*from w w w .ja v a 2 s .com*/ return method.invoke(bean, values); } catch (IllegalArgumentException e) { //log.error("Method invocation failed.", e); throw new IllegalArgumentException("Cannot invoke " + method.getDeclaringClass().getName() + "." + method.getName() + " - " + e.getMessage()); } } }