}
private PrepareTargetObjectResult prepareTargetObject(Object destObj) {
// Need to dig out actual destination Map object and use map property descriptor to set the value on that target object....
DozerPropertyDescriptor pd;
if (isDestFieldAccessible()) {
pd = new FieldPropertyDescriptor(destObj.getClass(), getDestFieldName(), isDestFieldIndexed(), getDestFieldIndex(),
getSrcDeepIndexHintContainer(), getDestDeepIndexHintContainer());
} else {
pd = new JavaBeanPropertyDescriptor(destObj.getClass(), getDestFieldName(), isDestFieldIndexed(), getDestFieldIndex(),
getSrcDeepIndexHintContainer(), getDestDeepIndexHintContainer());
}
Class<?> c = pd.getPropertyType();
Object targetObject = pd.getPropertyValue(destObj);
if (targetObject == null) {
// Create new instance of target object that will be populated.
if (getDestHintContainer() != null) {
if (MappingUtils.isSupportedMap(c)) {
if (MappingUtils.isSupportedMap(getDestHintContainer().getHint())) {
c = getDestHintContainer().getHint();
}
} else {
c = getDestHintContainer().getHint();
}
}
//TODO: add support for custom factory/create method in conjunction with Map backed properties
targetObject = DestBeanCreator.create(c, destObj.getClass());
pd.setPropertyValue(destObj, targetObject, this);
}
return new PrepareTargetObjectResult(targetObject, new MapPropertyDescriptor(c, getDestFieldName(), isDestFieldIndexed(),
getDestFieldIndex(), MappingUtils.isSupportedMap(c) ? "put" : getDestFieldMapSetMethod(),
MappingUtils.isSupportedMap(c) ? "get" : getDestFieldMapGetMethod(), getDestFieldKey() != null ? getDestFieldKey()