Java Reflection Method Invoke invokeMethod(Method m, Object instance, Object[] args)

Here you can find the source of invokeMethod(Method m, Object instance, Object[] args)

Description

invoke Method

License

Apache License

Parameter

Parameter Description
m a parameter
instance a parameter
args a parameter

Declaration

public static Object invokeMethod(Method m, Object instance, Object[] args) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.lang.reflect.Method;

public class Main {
    /**/*from w w  w.  j  av  a2 s. c  o  m*/
     * 
     * @param m
     * @param instance
     * @param args
     * @return
     */
    public static Object invokeMethod(Method m, Object instance, Object[] args) {
        try {
            return m.invoke(instance, args);
        } catch (Throwable t) {
            throw new IllegalStateException(t);
        }
    }
}

Related

  1. invokeMethod(final Object object, final String methodName, final Class[] parameterTypes, final Object[] parameters)
  2. invokeMethod(final Object object, final String methodName, final Class[] paramTypes, final Object[] parameters)
  3. invokeMethod(final Object p, final String methodName)
  4. invokeMethod(java.lang.Object toObj, String tcMethodName, Class toResultClass)
  5. invokeMethod(Method inMethod, Object inObject, Object[] inArgs)
  6. invokeMethod(Method m, Object[] o)
  7. invokeMethod(Method meth, String str)
  8. invokeMethod(Method method, Class beanClass, Object element)
  9. invokeMethod(Method method, Object bean, Object[] values)