List of utility methods to do Method Call
Object | invoke(Object invoker, String cmd, Map params) invoke Method method = invoker.getClass().getMethod(cmd, Map.class); return method.invoke(invoker, params); |
Object | invoke(Object methodHostInstance, String methodName, Class>[] parameterTypes, Object[] args) invoke try { Method method = methodHostInstance.getClass().getDeclaredMethod(methodName, parameterTypes); method.setAccessible(true); try { Object result = method.invoke(methodHostInstance, args); return result; } catch (IllegalArgumentException e) { e.printStackTrace(); ... |
Object | invoke(Object o, Method m) invoke Object ret = null; try { ret = m.invoke(o); } catch (Exception e) { return ret; |
Object | invoke(Object o, Method method, Object... param) invoke return method.invoke(o, param);
|
Object | invoke(Object o, String m, Object... params) invoke return invoke(o.getClass(), o, m, params);
|
Object | invoke(Object o, String method, Object... args) invoke Class[] argTypes = new Class[args.length]; for (int i = 0; i < args.length; i++) { argTypes[i] = args.getClass(); Method mthd = method(method, o.getClass()); mthd.setAccessible(true); return mthd.invoke(o, args); |
Object | invoke(Object o, String name) Invoke zero parameter method name. try { Method method = o.getClass().getMethod(name); method.setAccessible(true); return method.invoke(o); } catch (Exception e) { return null; |
Object | invoke(Object o, String name, Object[] args) invoke return invoke(o.getClass(), o, name, args);
|
Object | invoke(Object o, String name, Object[] args) invoke return invoke(o.getClass(), o, name, args);
|
Object | invoke(Object obj, Method method, Object[] args) invoke if (obj == null) throw new NullPointerException("invoke target object is NULL."); if (method.getDeclaringClass().isAssignableFrom(obj.getClass())) { return method.invoke(obj, args); } else { return obj.getClass().getMethod(method.getName(), method.getParameterTypes()).invoke(obj, args); |