List of utility methods to do Method Call
E | invoke(Object target, String methodName, Object... args) invoke for (Method method : target.getClass().getMethods()) { if (method.getName().equals(methodName)) { try { return (E) method.invoke(target, args); } catch (Exception e) { throw new RuntimeException("Exception invoking method " + methodName, e); throw new RuntimeException("Method " + methodName + " not found"); |
Object | invoke(Object target, String methodName, Object[] args) invoke try { Class<? extends Object> clazz = target.getClass(); Method method = findMethod(clazz, methodName, args); method.setAccessible(true); return method.invoke(target, args); } catch (Exception e) { throw new RuntimeException("couldn't invoke " + methodName + " on " + target, e); |
Object | invoke(Object target, String name, Class[] params, Object[] args) Returns the result of invoking the method name on target with parameters params declared in the target 's class using arguments args .
return invoke(target.getClass(), target, name, params, args);
|
Object | invoke(Object targetObject, String method, Class>[] paramTypes, Object[] paramValues) invoke String methodKey = getMethodKey(targetObject.getClass(), method, paramTypes); Method methodObject = METHOD_CACHE.get(methodKey); if (methodObject == null) { methodObject = targetObject.getClass().getMethod(method, paramTypes); if (methodObject != null) { METHOD_CACHE.put(methodKey, methodObject); return methodObject.invoke(targetObject, paramValues); |
Object | invoke(Object targetObject, String methodName, Object... params) invoke return findMethod(targetObject.getClass(), methodName, params).invoke(targetObject, params);
|
T | invoke(Object thisObject, Method method) invoke return (T) method.invoke(thisObject, NO_PARAM_SIGNATURE);
|
Object | invoke(ObjectName objectName, Object[] params, String[] signature, String operationName) invoke Object result = platformMBeanServer.invoke(objectName, operationName, params, signature);
return result;
|
T | invoke(ObjectName objectName, String attribute, Object[] params, String[] signatur) invoke try { return (T) mbeanServer.invoke(objectName, attribute, params, signatur); } catch (MBeanException e) { throw new RuntimeException(e); } catch (InstanceNotFoundException e) { throw new RuntimeException(e); } catch (ReflectionException e) { throw new RuntimeException(e); ... |
Optional | invoke(Optional invoke try { return invoke(method, clazz.newInstance(), args); } catch (InstantiationException | IllegalAccessException e) { e.printStackTrace(); return Optional.empty(); |
Object | invoke(String className, String methodName, Class>[] paramTypes, Object... params) invoke return invoke(null, className, methodName, paramTypes, params);
|