Here you can find the source of invokeMethod(Object bean, Method method, Object[] args)
Parameter | Description |
---|---|
bean | a parameter |
method | a parameter |
args | a parameter |
Parameter | Description |
---|---|
IllegalArgumentException | an exception |
IllegalAccessException | an exception |
InvocationTargetException | an exception |
public static Object invokeMethod(Object bean, Method method, Object[] args) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
//package com.java2s; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class Main { /**// w w w .j a va 2 s .c om * Invokes supplied method against the supplied bean * * @param bean * @param method * @param args * @return Object value returned by the method invokation * @throws IllegalArgumentException * @throws IllegalAccessException * @throws InvocationTargetException */ public static Object invokeMethod(Object bean, Method method, Object[] args) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { return method.invoke(bean, args); } }