private Class<?> determineActualPropertyType(String fieldName, boolean isIndexed, int index, Object targetObj, boolean isDestObj) { // Dig out actual Map object by calling getter on top level object DozerPropertyDescriptor pd; if ((isDestObj && isDestFieldAccessible()) || (!isDestObj && isSrcFieldAccessible())) { pd = new FieldPropertyDescriptor(targetObj.getClass(), fieldName, isIndexed, index, getSrcDeepIndexHintContainer(), getDestDeepIndexHintContainer()); } else { pd = new JavaBeanPropertyDescriptor(targetObj.getClass(), fieldName, isIndexed, index, getSrcDeepIndexHintContainer(), getDestDeepIndexHintContainer()); } return pd.getPropertyType(); }
private Class<?> determineActualPropertyType(String fieldName, boolean isIndexed, String index, Object targetObj, boolean isDestObj) { // Dig out actual Map object by calling getter on top level object DozerPropertyDescriptor pd; if ((isDestObj && isDestFieldAccessible()) || (!isDestObj && isSrcFieldAccessible())) { pd = new FieldPropertyDescriptor(targetObj.getClass(), fieldName, isIndexed, index, isDestObj ? getDestDeepIndexHintContainer() : getSrcDeepIndexHintContainer()); } else { pd = new JavaBeanPropertyDescriptor(targetObj.getClass(), fieldName, isIndexed, index, isDestObj ? getDestDeepIndexHintContainer() : getSrcDeepIndexHintContainer()); } return pd.getPropertyType(); }
private Class<?> determineActualPropertyType(String fieldName, boolean isIndexed, String index, Object targetObj, boolean isDestObj) { // Dig out actual Map object by calling getter on top level object DozerPropertyDescriptor pd; if ((isDestObj && isDestFieldAccessible()) || (!isDestObj && isSrcFieldAccessible())) { pd = new FieldPropertyDescriptor(targetObj.getClass(), fieldName, isIndexed, index, isDestObj ? getDestDeepIndexHintContainer() : getSrcDeepIndexHintContainer()); } else { pd = new JavaBeanPropertyDescriptor(targetObj.getClass(), fieldName, isIndexed, index, isDestObj ? getDestDeepIndexHintContainer() : getSrcDeepIndexHintContainer()); } return pd.getPropertyType(); }
if (isDestFieldAccessible()) { pd = new FieldPropertyDescriptor(destObj.getClass(), getDestFieldName(), isDestFieldIndexed(), getDestFieldIndex(), getDestDeepIndexHintContainer()); } else { pd = new JavaBeanPropertyDescriptor(destObj.getClass(), getDestFieldName(), isDestFieldIndexed(), getDestFieldIndex(), getDestDeepIndexHintContainer()); : getDestFieldMapSetMethod(), MappingUtils.isSupportedMap(c) ? "get" : getDestFieldMapGetMethod(), getDestFieldKey() != null ? getDestFieldKey() : getSrcFieldName(), getDestDeepIndexHintContainer()));
if (isDestFieldAccessible()) { pd = new FieldPropertyDescriptor(destObj.getClass(), getDestFieldName(), isDestFieldIndexed(), getDestFieldIndex(), getSrcDeepIndexHintContainer(), getDestDeepIndexHintContainer()); } else { pd = new JavaBeanPropertyDescriptor(destObj.getClass(), getDestFieldName(), isDestFieldIndexed(), getDestFieldIndex(), getSrcDeepIndexHintContainer(), getDestDeepIndexHintContainer()); getDestFieldIndex(), MappingUtils.isSupportedMap(c) ? "put" : getDestFieldMapSetMethod(), MappingUtils.isSupportedMap(c) ? "get" : getDestFieldMapGetMethod(), getDestFieldKey() != null ? getDestFieldKey() : getSrcFieldName(), getSrcDeepIndexHintContainer(), getDestDeepIndexHintContainer()));
isDestFieldIndexed(), getDestFieldIndex(), getDestDeepIndexHintContainer()); } else { pd = new JavaBeanPropertyDescriptor(destObj.getClass(), isDestFieldIndexed(), getDestFieldIndex(), getDestDeepIndexHintContainer()); MappingUtils.isSupportedMap(c) ? "get" : getDestFieldMapGetMethod(), getDestFieldKey() != null ? getDestFieldKey() : getSrcFieldName(), getDestDeepIndexHintContainer()));
@Override public Object getSrcFieldValue(Object srcObj) { DozerPropertyDescriptor propDescriptor; Object targetObject = srcObj; if (getSrcFieldName().equals(DozerConstants.SELF_KEYWORD)) { propDescriptor = super.getSrcPropertyDescriptor(srcObj.getClass()); } else { Class<?> actualType = determineActualPropertyType(getSrcFieldName(), isSrcFieldIndexed(), getSrcFieldIndex(), srcObj, false); if ((getSrcFieldMapGetMethod() != null) || (this.getMapId() == null && MappingUtils.isSupportedMap(actualType) && getSrcHintContainer() == null)) { // Need to dig out actual map object by using getter on the field. Use actual map object to get the field value targetObject = super.getSrcFieldValue(srcObj); String setMethod = MappingUtils.isSupportedMap(actualType) ? "put" : getSrcFieldMapSetMethod(); String getMethod = MappingUtils.isSupportedMap(actualType) ? "get" : getSrcFieldMapGetMethod(); String key = getSrcFieldKey() != null ? getSrcFieldKey() : getDestFieldName(); propDescriptor = new MapPropertyDescriptor(actualType, getSrcFieldName(), isSrcFieldIndexed(), getDestFieldIndex(), setMethod, getMethod, key, getSrcDeepIndexHintContainer(), getDestDeepIndexHintContainer()); } else { propDescriptor = super.getSrcPropertyDescriptor(srcObj.getClass()); } } Object result = null; if (targetObject != null) { result = propDescriptor.getPropertyValue(targetObject); } return result; }