Here you can find the source of invoke(Object bean, String methodName, Object args, Class> parameterType)
public static Object invoke(Object bean, String methodName, Object args, Class<?> parameterType)
//package com.java2s; //License from project: Open Source License import java.lang.reflect.Method; public class Main { public static Object invoke(Object bean, String methodName, Object args, Class<?> parameterType) { Class<?> serviceClass = null; Method businessMethod = null; Object obj = null;/*w w w . j ava 2 s. c o m*/ try { serviceClass = bean.getClass(); businessMethod = serviceClass.getMethod(methodName, parameterType); obj = businessMethod.invoke(bean, args); } catch (Exception e) { e.printStackTrace(); } return obj; } public static Object invoke(Object bean, String methodName, Object[] args, Class<?>... parameterTypes) { Class<?> serviceClass = null; Method businessMethod = null; Object obj = null; try { serviceClass = bean.getClass(); businessMethod = serviceClass.getMethod(methodName, parameterTypes); obj = businessMethod.invoke(bean, args); } catch (Exception e) { e.printStackTrace(); } return obj; } }