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

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

Description

invoke Method

License

Apache License

Declaration

public static Object invokeMethod(Method method, Object target, Object... args) 

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... args) {
        Object obj = null;/*  w  w w. j a  va 2s  . com*/
        try {
            obj = method.invoke(target, args);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
        return obj;
    }
}

Related

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