@Test public void givenThatPrivateFieldExistsItWillBeRetrievedByGetFieldValue() { Object result = ReflectionUtils.getFieldValue(new DummyBean(), "value"); assertEquals("expectedValue", result); }
public static Object getFieldValue(Object entity, String fieldName) { try { Field field = getField(entity, fieldName); return field.get(entity); } catch (Exception e) { throw new HateoasInjectException(e); } }
ReflectionUtils { public static Object getFieldValue(Object entity, String fieldName) { try { Field field = getField(entity, fieldName); return field.get(entity); } catch (Exception e) { throw new HateoasInjectException(e); } } }
ReflectionUtils { public static Object getFieldValue(Object entity, String fieldName) { try { Field field = getField(entity, fieldName); return field.get(entity); } catch (Exception e) { throw new HateoasInjectException(e); } } private  ReflectionUtils(); }
ReflectionUtils { public static Object getFieldValue(Object entity, String fieldName) { try { Field field = getField(entity, fieldName); return field.get(entity); } 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 Object getFieldValue(Object entity, String fieldName) { try { Field field = getField(entity, fieldName); return field.get(entity); } 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);  }