FieldPropertyDescriptor extends AbstractPropertyDescriptor implements DozerPropertyDescriptor { public Object getPropertyValue(Object bean) { Object intermediateResult = bean; for (DozerPropertyDescriptor descriptor : descriptorChain) { intermediateResult = descriptor.getPropertyValue(intermediateResult); if (intermediateResult == null) { return null; } } return intermediateResult; } FieldPropertyDescriptor(Class<?> clazz, String fieldName, boolean isIndexed, int index,
                                   HintContainer srcDeepIndexHintContainer, HintContainer destDeepIndexHintContainer,
                                   DestBeanCreator destBeanCreator); Class<?> getPropertyType(); Class<?> genericType(); Object getPropertyValue(Object bean); void setPropertyValue(Object bean, Object value, FieldMap fieldMap);  }
@Test public void getPropertyValue() { FieldPropertyDescriptor descriptor = new FieldPropertyDescriptor(Container.class, "hidden", false, 0, null, null, destBeanCreator); Object result = descriptor.getPropertyValue(new Container()); assertEquals(42, result); }
@Test public void getPropertyValueChained() { FieldPropertyDescriptor descriptor = new FieldPropertyDescriptor(Container.class, "container.hidden", false, 0, null, null, destBeanCreator); Object result = descriptor.getPropertyValue(new Container("A")); assertEquals(42, result); }
@Test public void getPropertyValueChained_IntermediateNull() { FieldPropertyDescriptor descriptor = new FieldPropertyDescriptor(Container.class, "container.value", false, 0, null, null, destBeanCreator); Container bean = new Container(""); Object value = descriptor.getPropertyValue(bean); assertEquals("", value); }
@Test public void getPropertyValueIndexed() { FieldPropertyDescriptor descriptor = new FieldPropertyDescriptor(Container.class, "values", true, 0, null, null, destBeanCreator); Container container = new Container(""); container.values.add("A"); Object value = descriptor.getPropertyValue(container); assertEquals("A", value); }