@Test public void testPrivateModelObjectAnnotatedFieldInSuperclass() { PmoWithModelObjectFieldInSuperclass pmoWithModelObjectFieldInSuperclass = new PmoWithModelObjectFieldInSuperclass(); Object modelObject = ModelObjects .supplierFor(pmoWithModelObjectFieldInSuperclass, ModelObject.DEFAULT_NAME).get(); assertThat(modelObject, is(not(nullValue()))); assertThat(modelObject, instanceOf(TestSub.class)); }
public static Supplier<Object> supplierFor(Object pmo, String modelObjectName) { Member accessMember = getModelObjectAccessMember(pmo, modelObjectName) .orElseThrow(() -> ModelObjectAnnotationException.noAnnotatedMember(pmo.getClass(), modelObjectName)); return () -> MemberAccessors.getValue(pmo, accessMember); }
ModelObjects { public static Supplier<Object> supplierFor(Object pmo, String modelObjectName) { Member accessMember = getModelObjectAccessMember(pmo, modelObjectName) .orElseThrow(() -> ModelObjectAnnotationException.noAnnotatedMember(pmo.getClass(), modelObjectName)); return () -> MemberAccessors.getValue(pmo, accessMember); } }
ModelObjects { public static Supplier<Object> supplierFor(Object pmo, String modelObjectName) { Member accessMember = getModelObjectAccessMember(pmo, modelObjectName) .orElseThrow(() -> ModelObjectAnnotationException.noAnnotatedMember(pmo.getClass(), modelObjectName)); return () -> MemberAccessors.getValue(pmo, accessMember); } private  ModelObjects(Class<?> pmoClass, String modelObjectName); }
ModelObjects { public static Supplier<Object> supplierFor(Object pmo, String modelObjectName) { Member accessMember = getModelObjectAccessMember(pmo, modelObjectName) .orElseThrow(() -> ModelObjectAnnotationException.noAnnotatedMember(pmo.getClass(), modelObjectName)); return () -> MemberAccessors.getValue(pmo, accessMember); } private  ModelObjects(Class<?> pmoClass, String modelObjectName); static Supplier<Object> supplierFor(Object pmo, String modelObjectName); static boolean isAccessible(Object pmo, String modelObjectName); }
ModelObjects { public static Supplier<Object> supplierFor(Object pmo, String modelObjectName) { Member accessMember = getModelObjectAccessMember(pmo, modelObjectName) .orElseThrow(() -> ModelObjectAnnotationException.noAnnotatedMember(pmo.getClass(), modelObjectName)); return () -> MemberAccessors.getValue(pmo, accessMember); } private  ModelObjects(Class<?> pmoClass, String modelObjectName); static Supplier<Object> supplierFor(Object pmo, String modelObjectName); static boolean isAccessible(Object pmo, String modelObjectName);  }