Java Reflection Method Invoke invokeMethod(Object parent, String method, Class[] paramTypes, Object[] args)

Here you can find the source of invokeMethod(Object parent, String method, Class[] paramTypes, Object[] args)

Description

invoke Method

License

Apache License

Declaration

public static void invokeMethod(Object parent, String method, Class<?>[] paramTypes, Object[] args) 

Method Source Code


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

import java.lang.reflect.InvocationTargetException;

public class Main {
    public static void invokeMethod(Object parent, String method, Class<?>[] paramTypes, Object[] args) {
        try {/*from w w  w .ja v a  2 s.  c o  m*/
            parent.getClass().getMethod(method, paramTypes).invoke(parent, args);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (SecurityException e) {
            e.printStackTrace();
        }
    }
}

Related

  1. invokeMethod(Object object, String name, Object... arguments)
  2. invokeMethod(Object object, String propertyName)
  3. invokeMethod(Object objectInstance, String methodToInvoke, Class[] parameterTypes, Object[] instanceParameters)
  4. invokeMethod(Object owner, String methodName)
  5. invokeMethod(Object owner, String methodName, Object[] args)
  6. invokeMethod(Object source, String method, Collection arguments)
  7. invokeMethod(Object sourceObject, String methodName, Object... arguments)
  8. invokeMethod(Object target, Class clazz, String methodName, Class[] types, Object[] args)
  9. invokeMethod(Object target, Method method)

  10. HOME | Copyright © www.java2s.com 2016