public Class<?> getDestFieldType(Class<?> runtimeDestClass) { Class<?> result = null; if (isDestFieldIndexed()) { result = destHintContainer != null ? destHintContainer.getHint() : null; } if (result == null) { result = getDestPropertyDescriptor(runtimeDestClass).getPropertyType(); } return result; }
public static Class<?> determineCustomConverter(FieldMap fieldMap, Cache converterByDestTypeCache, CustomConverterContainer customConverterContainer, Class<?> srcClass, Class<?> destClass) { if (customConverterContainer == null) { return null; } // This method is messy. Just trying to isolate the junk into this one method instead of spread across the mapping // processor until a better solution can be put into place // For indexed mapping, need to use the actual class at index to determine the custom converter. if (fieldMap != null && fieldMap.isDestFieldIndexed()) { if (destClass.isArray()) { destClass = destClass.getComponentType(); } else if (destClass.isAssignableFrom(Collection.class) && fieldMap.getDestHintContainer() != null && !fieldMap.getDestHintContainer().hasMoreThanOneHint()) { // use hint when trying to find a custom converter destClass = fieldMap.getDestHintContainer().getHint(); } } return findCustomConverter(converterByDestTypeCache, customConverterContainer, srcClass, destClass); }
if (fieldMap != null && fieldMap.isDestFieldIndexed()) { if (destClass.isArray()) { destType = destClass.getComponentType();
public Class<?> getDestFieldType(Class<?> runtimeDestClass) { Class<?> result = getDestPropertyDescriptor(runtimeDestClass).getPropertyType(); if (isDestFieldIndexed()) { HintContainer hintContainer = destField.getHintContainer(); if (hintContainer != null) { result = hintContainer.getHint(); } else if ((result.isArray() || (Collection.class.isAssignableFrom(result)) && MappingUtils.getSupportedCollectionEntryType(getDestPropertyDescriptor(runtimeDestClass)) != null)) { result = MappingUtils.getSupportedCollectionEntryType(getDestPropertyDescriptor(runtimeDestClass)); } else { result = Object.class; } } return result; }
if (fieldMap != null && fieldMap.isDestFieldIndexed()) { if (destClass.isArray()) { destType = destClass.getComponentType();
public Class<?> getDestFieldType(Class<?> runtimeDestClass) { Class<?> result = getDestPropertyDescriptor(runtimeDestClass).getPropertyType(); if (isDestFieldIndexed()) { HintContainer hintContainer = destField.getHintContainer(); if (hintContainer != null) { result = hintContainer.getHint(); } else if ((result.isArray() || (Collection.class.isAssignableFrom(result)) && MappingUtils .getSupportedCollectionEntryType(getDestPropertyDescriptor(runtimeDestClass)) != null)) { result = MappingUtils.getSupportedCollectionEntryType(getDestPropertyDescriptor(runtimeDestClass)); } else { result = Object.class; } } return result; }
protected DozerPropertyDescriptor getDestPropertyDescriptor(Class<?> runtimeDestClass) { if (BeanBuilder.class.isAssignableFrom(runtimeDestClass)) { MappingUtils.throwMappingException( "getDestPropertyDescriptor received builder instead of concrete class - it's a bug, please post stack trace at https://github.com/DozerMapper/dozer or directly to dmitry@spikhalskiy.com "); return null; } DozerPropertyDescriptor result = this.destPropertyDescriptorMap.get(runtimeDestClass); if (result == null) { DozerPropertyDescriptor descriptor = PropertyDescriptorFactory.getPropertyDescriptor(runtimeDestClass, getDestFieldTheGetMethod(), getDestFieldTheSetMethod(), getDestFieldMapGetMethod(), getDestFieldMapSetMethod(), isDestFieldAccessible(), isDestFieldIndexed(), getDestFieldIndex(), getDestFieldName(), getDestFieldKey(), isDestSelfReferencing(), getSrcFieldName(), getSrcDeepIndexHintContainer(), getDestDeepIndexHintContainer(), classMap.getDestClassBeanFactory()); this.destPropertyDescriptorMap.putIfAbsent(runtimeDestClass, descriptor); result = descriptor; } return result; }
public DozerPropertyDescriptor getDestPropertyDescriptor(Class<?> runtimeDestClass) { DozerPropertyDescriptor result = this.destPropertyDescriptorMap.get(runtimeDestClass); if (result == null) { DozerPropertyDescriptor descriptor = PropertyDescriptorFactory.getPropertyDescriptor(runtimeDestClass, getDestFieldTheGetMethod(), getDestFieldTheSetMethod(), getDestFieldMapGetMethod(), getDestFieldMapSetMethod(), isDestFieldAccessible(), isDestFieldIndexed(), getDestFieldIndex(), getDestFieldName(), getDestFieldKey(), isDestSelfReferencing(), getSrcFieldName(), getDestDeepIndexHintContainer(), classMap.getDestClassBeanFactory()); this.destPropertyDescriptorMap.putIfAbsent(runtimeDestClass, descriptor); result = descriptor; } return result; }
public DozerPropertyDescriptor getDestPropertyDescriptor(Class<?> runtimeDestClass) { DozerPropertyDescriptor result = this.destPropertyDescriptorMap.get(runtimeDestClass); if (result == null) { DozerPropertyDescriptor descriptor = PropertyDescriptorFactory.getPropertyDescriptor(runtimeDestClass, getDestFieldTheGetMethod(), getDestFieldTheSetMethod(), getDestFieldMapGetMethod(), getDestFieldMapSetMethod(), isDestFieldAccessible(), isDestFieldIndexed(), getDestFieldIndex(), getDestFieldName(), getDestFieldKey(), isDestSelfReferencing(), getSrcFieldName(), getDestDeepIndexHintContainer(), classMap.getDestClassBeanFactory()); this.destPropertyDescriptorMap.putIfAbsent(runtimeDestClass, descriptor); result = descriptor; } return result; }