Java Reflection Method Invoke invokeMethod(Method method, Object target, Object... arguments)

Here you can find the source of invokeMethod(Method method, Object target, Object... arguments)

Description

invoke Method

License

Apache License

Declaration

public static Object invokeMethod(Method method, Object target, Object... arguments)
            throws InvocationTargetException 

Method Source Code

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

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class Main {
    public static Object invokeMethod(Method method, Object target, Object... arguments)
            throws InvocationTargetException {
        if (!method.isAccessible()) {
            method.setAccessible(true);//from   w w  w.j a  va2  s  .  c o  m
        }
        try {
            return method.invoke(target, arguments);
        } catch (IllegalAccessException ex) {
            throw new RuntimeException("", ex);
        }
    }
}

Related

  1. invokeMethod(Method method, Object target)
  2. invokeMethod(Method method, Object target)
  3. invokeMethod(Method method, Object target, Class expectedType)
  4. invokeMethod(Method method, Object target, Object... args)
  5. invokeMethod(Method method, Object target, Object... args)
  6. invokeMethod(Method method, Object target, Object... params)
  7. invokeMethod(Method method, Object target, Object[] args)
  8. invokeMethod(Method method, Object target, Object[] args)
  9. invokeMethod(Method method, Object theObject, Object[] args)