@Test public void givenThatFieldExistsItCanBeSet() { DummyBean dummyBean = new DummyBean(); ReflectionUtils.setField(dummyBean, "value", "newValue"); assertEquals("newValue", dummyBean.getValue()); }
public static void setField(Object entity, String fieldName, Object value) { try { Field field = getField(entity, fieldName); field.set(entity, value); } catch (Exception e) { throw new HateoasInjectException(e); } }
ReflectionUtils { public static void setField(Object entity, String fieldName, Object value) { try { Field field = getField(entity, fieldName); field.set(entity, value); } catch (Exception e) { throw new HateoasInjectException(e); } } }
ReflectionUtils { public static void setField(Object entity, String fieldName, Object value) { try { Field field = getField(entity, fieldName); field.set(entity, value); } catch (Exception e) { throw new HateoasInjectException(e); } } private  ReflectionUtils(); }
ReflectionUtils { public static void setField(Object entity, String fieldName, Object value) { try { Field field = getField(entity, fieldName); field.set(entity, value); } catch (Exception e) { throw new HateoasInjectException(e); } } private  ReflectionUtils(); static boolean hasField(Object entity, String fieldName); static boolean hasFieldHierarchical(Object entity, String fieldName); static boolean hasField(Class clazz, String fieldName); static void setFieldAccessible(Field field); static Object getFieldValue(Object entity, String fieldName); static Object getFieldValueHierarchical(Object entity, String fieldName); static Field getField(Object entity, String fieldName); static Field getField(Class clazz, String fieldName); static Collection<Field> getFieldsHierarchical(Class clazz); static Field getFieldHierarchical(Class clazz, String fieldName); static void setFieldHierarchical(Object entity, String fieldName, Object value); static void setField(Object entity, String fieldName, Object value); }
ReflectionUtils { public static void setField(Object entity, String fieldName, Object value) { try { Field field = getField(entity, fieldName); field.set(entity, value); } catch (Exception e) { throw new HateoasInjectException(e); } } private  ReflectionUtils(); static boolean hasField(Object entity, String fieldName); static boolean hasFieldHierarchical(Object entity, String fieldName); static boolean hasField(Class clazz, String fieldName); static void setFieldAccessible(Field field); static Object getFieldValue(Object entity, String fieldName); static Object getFieldValueHierarchical(Object entity, String fieldName); static Field getField(Object entity, String fieldName); static Field getField(Class clazz, String fieldName); static Collection<Field> getFieldsHierarchical(Class clazz); static Field getFieldHierarchical(Class clazz, String fieldName); static void setFieldHierarchical(Object entity, String fieldName, Object value); static void setField(Object entity, String fieldName, Object value);  }