Java Method Call invoke(Object context, String methodName, Object parameter)

Here you can find the source of invoke(Object context, String methodName, Object parameter)

Description

invoke

License

Open Source License

Declaration

public static void invoke(Object context, String methodName, Object parameter) 

Method Source Code


//package com.java2s;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class Main {
    public static void invoke(Object context, String methodName, Object parameter) {
        try {/*from ww w .  j a  va  2s .  c  om*/
            Class methodHodler = context.getClass();
            Method method = methodHodler.getMethod(methodName, parameter.getClass());
            method.invoke(context, parameter);
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    }
}

Related

  1. invoke(Object bean, Method method, Object value)
  2. invoke(Object bean, Method method, Object value)
  3. invoke(Object bean, String methodName, Object args, Class parameterType)
  4. invoke(Object buffer, String methodName, Class[] paramTypes, Object... args)
  5. invoke(Object clazzInstance, String method, Class[] paramClasses, Object[] params)
  6. invoke(Object host, String method, Object[] args)
  7. invoke(Object instance, java.lang.reflect.Method method, Object... args)
  8. invoke(Object instance, Method method, Object... params)
  9. invoke(Object instance, String method, Class[] paramTypes, Object... parameters)