public void destHintContainer(String hint) { HintContainer hintContainer = new HintContainer(); hintContainer.setHintName(hint); this.destHintContainer = hintContainer; }
public Class<?> getHint() { Class<?> result; if (hasMoreThanOneHint()) { return null; } else { result = getHints().get(0); } return result; }
private List<?> mapArrayToList(Object srcObj, Object srcCollectionValue, FieldMap fieldMap, Object destObj) { Class<?> destEntryType; if (fieldMap.getDestHintContainer() != null) { destEntryType = fieldMap.getDestHintContainer().getHint(); } else { destEntryType = srcCollectionValue.getClass().getComponentType(); } List<?> srcValueList; if (CollectionUtils.isPrimitiveArray(srcCollectionValue.getClass())) { srcValueList = CollectionUtils.convertPrimitiveArrayToList(srcCollectionValue); } else { srcValueList = Arrays.asList((Object[]) srcCollectionValue); } return addOrUpdateToList(srcObj, fieldMap, srcValueList, destObj, destEntryType); }
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); }
public boolean hasMoreThanOneHint() { return getHints().size() > 1; }
for (Object srcValue : srcCollectionValue) { if (destEntryType == null || (fieldMap.getDestHintContainer() != null && fieldMap.getDestHintContainer() .hasMoreThanOneHint())) { if (srcValue == null) { destEntryType = prevDestEntryType;
clazz = fieldMap.getDestHintContainer().getHint(); hintType = fieldMap.getDestDeepIndexHintContainer().getHint(i); if (fieldMap.getDestDeepIndexHintContainer() != null && fieldMap.getDestDeepIndexHintContainer().hasHintType(i)) { clazz = fieldMap.getDestDeepIndexHintContainer().getHint(i); hintType = fieldMap.getDestDeepIndexHintContainer().getHint(i);
private List<?> mapArrayToList(Object srcObj, Object srcCollectionValue, FieldMap fieldMap, Object destObj, MappingContext context) { Class<?> destEntryType; if (fieldMap.getDestHintContainer() != null) { destEntryType = fieldMap.getDestHintContainer().getHint(); } else { destEntryType = srcCollectionValue.getClass().getComponentType(); } List<?> srcValueList; if (CollectionUtils.isPrimitiveArray(srcCollectionValue.getClass())) { srcValueList = CollectionUtils.convertPrimitiveArrayToList(srcCollectionValue); } else { srcValueList = Arrays.asList((Object[]) srcCollectionValue); } return addOrUpdateToList(srcObj, fieldMap, srcValueList, destObj, destEntryType, context); }
} else if (destClass .isAssignableFrom(Collection.class) && fieldMap.getDestHintContainer() != null && !fieldMap .getDestHintContainer().hasMoreThanOneHint()) { destType = fieldMap.getDestHintContainer().getHint();
public boolean hasMoreThanOneHint() { return getHints().size() > 1; }
for (Object srcValue : srcCollectionValue) { if (destEntryType == null || (fieldMap.getDestHintContainer() != null && fieldMap.getDestHintContainer().hasMoreThanOneHint())) { destEntryType = determineCollectionItemType(fieldMap, destObj, srcValue, prevDestEntryType);
clazz = fieldMap.getDestHintContainer().getHint(); hintType = fieldMap.getDestDeepIndexHintContainer().getHint(i); .hasHintType(i)) { clazz = fieldMap.getDestDeepIndexHintContainer().getHint(i); hintType = fieldMap.getDestDeepIndexHintContainer().getHint(i);
public void srcDeepIndexHintContainer(String hint) { HintContainer hintContainer = new HintContainer(); hintContainer.setHintName(hint); this.srcDeepIndexHintContainer = hintContainer; }
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 Class<?> getHint() { Class<?> result; if (hasMoreThanOneHint()) { return null; } else { result = getHints().get(0); } return result; }
destType = destClass.getComponentType(); } else if (destClass.isAssignableFrom(Collection.class) && fieldMap.getDestHintContainer() != null && !fieldMap.getDestHintContainer() .hasMoreThanOneHint()) { destType = fieldMap.getDestHintContainer().getHint();
public Class<?> getHint(int index) { return getHints().get(index); }
for (Object srcValue : srcCollectionValue) { if (destEntryType == null || (fieldMap.getDestHintContainer() != null && fieldMap.getDestHintContainer() .hasMoreThanOneHint())) { if (srcValue == null) { destEntryType = prevDestEntryType;