List of utility methods to do Reflection Method Getter Invoke
Object | invokeGetterMethod(final Method method, final Object object) Invokes the supplied method on the supplied object. try { return method.invoke(object); } catch (IllegalAccessException | InvocationTargetException e) { throw new IllegalArgumentException(e); |
Object | invokeGetterSafe(Object o, String name, boolean forceAccess) invoke Getter Safe try { return invokeGetter(o, name, forceAccess); } catch (Exception e) { return nameOf(o) + "." + name + "() " + nameOf(e) + ": " + e.getMessage(); |
void | invokeSetter(Object target, Class clazz, String methodName, String getterMethod, Object param) invoke Setter Method getter = clazz.getMethod(getterMethod, (Class[]) null);
Method setter = clazz.getMethod(methodName, new Class[] { getter.getReturnType() });
setter.invoke(target, param);
|
String | invokeStringGetterSafe(Object o, String name) invoke String Getter Safe try { return invokeStringGetter(o, name); } catch (Exception e) { return nameOf(o) + "." + name + "() " + nameOf(e) + ": " + e.getMessage(); |