List of utility methods to do Field Set
void | setFieldValue(Object obj, String name, Object value) set Field Value Field field; try { field = obj.getClass().getDeclaredField(name); field.setAccessible(true); field.set(obj, value); } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { ... |
void | setFieldValue(Object obj, String propertyName, Object value) set Field Value try { Field field = obj.getClass().getDeclaredField(propertyName); field.setAccessible(true); field.set(obj, value); } catch (Exception ex) { throw new RuntimeException(); |