@Override public void writeDestValue(Object destObj, Object destFieldValue) { DozerPropertyDescriptor propDescriptor; Object targetObject = destObj; if (getDestFieldName().equals(DozerConstants.SELF_KEYWORD) || (destFieldValue != null && MappingUtils.isSupportedMap(destFieldValue.getClass()))) { // Destination value is already a Map, so just use normal propDescriptor = super.getDestPropertyDescriptor(destObj.getClass()); } else { if (getDestFieldMapGetMethod() != null || MappingUtils.isSupportedMap(determineActualPropertyType(getDestFieldName(), isDestFieldIndexed(), getDestFieldIndex(), destObj, true))) { // Need to dig out actual destination Map object and use map property descriptor to set the value on that target object.... PrepareTargetObjectResult result = prepareTargetObject(destObj); targetObject = result.targetObject; propDescriptor = result.propDescriptor; } else { propDescriptor = super.getDestPropertyDescriptor(destObj.getClass()); } } propDescriptor.setPropertyValue(targetObject, destFieldValue, this); }
@Override public void writeDestValue(Object destObj, Object destFieldValue) { DozerPropertyDescriptor propDescriptor; Object targetObject = destObj; if (getDestFieldName().equals(DozerConstants.SELF_KEYWORD) || (destFieldValue != null && MappingUtils .isSupportedMap(destFieldValue.getClass()))) { // Destination value is already a Map, so just use normal propDescriptor = super.getDestPropertyDescriptor(destObj.getClass()); } else { if (getDestFieldMapGetMethod() != null || MappingUtils.isSupportedMap(determineActualPropertyType( getDestFieldName(), isDestFieldIndexed(), getDestFieldIndex(), destObj, true))) { // Need to dig out actual destination Map object and use map // property descriptor to set the value on that target // object.... PrepareTargetObjectResult result = prepareTargetObject(destObj); targetObject = result.targetObject; propDescriptor = result.propDescriptor; } else { propDescriptor = super.getDestPropertyDescriptor(destObj.getClass()); } } propDescriptor.setPropertyValue(targetObject, destFieldValue, this); }
@Override public void writeDestValue(Object destObj, Object destFieldValue) { DozerPropertyDescriptor propDescriptor; Object targetObject = destObj; if (getDestFieldName().equals(DozerConstants.SELF_KEYWORD) || (destFieldValue != null && MappingUtils .isSupportedMap(destFieldValue.getClass()))) { // Destination value is already a Map, so just use normal propDescriptor = super.getDestPropertyDescriptor(destObj.getClass()); } else { if (getDestFieldMapGetMethod() != null || MappingUtils.isSupportedMap(determineActualPropertyType( getDestFieldName(), isDestFieldIndexed(), getDestFieldIndex(), destObj, true))) { // Need to dig out actual destination Map object and use map // property descriptor to set the value on that target // object.... PrepareTargetObjectResult result = prepareTargetObject(destObj); targetObject = result.targetObject; propDescriptor = result.propDescriptor; } else { propDescriptor = super.getDestPropertyDescriptor(destObj.getClass()); } } propDescriptor.setPropertyValue(targetObject, destFieldValue, this); }
@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; }