private Object getDeepSrcFieldValue(Object srcObj) { // follow deep field hierarchy. If any values are null along the way, then return null Object parentObj = srcObj; Object hierarchyValue = parentObj; DeepHierarchyElement[] hierarchy = getDeepFieldHierarchy(srcObj, srcDeepIndexHintContainer); int size = hierarchy.length; for (int i = 0; i < size; i++) { DeepHierarchyElement hierarchyElement = hierarchy[i]; PropertyDescriptor pd = hierarchyElement.getPropDescriptor(); // If any fields in the deep hierarchy are indexed, get actual value within the collection at the specified index if (hierarchyElement.getIndex() > -1) { hierarchyValue = MappingUtils.getIndexedValue(ReflectionUtils.invoke(pd.getReadMethod(), hierarchyValue, null), hierarchyElement.getIndex()); } else { hierarchyValue = ReflectionUtils.invoke(pd.getReadMethod(), parentObj, null); } parentObj = hierarchyValue; if (hierarchyValue == null) { break; } } // If dest field is indexed, get actual value within the collection at the specified index if (isIndexed) { hierarchyValue = MappingUtils.getIndexedValue(hierarchyValue, index); } return hierarchyValue; }
if (!MappingUtils.isBlankOrNull(hierarchyElement.getIndex())) { Object bean = ReflectionUtils.invoke(pd.getReadMethod(), hierarchyValue, null); if (MappingUtils.isSimpleCollectionIndex(hierarchyElement.getIndex())) { int collectionIndex = MappingUtils.getCollectionIndex(hierarchyElement.getIndex()); hierarchyValue = MappingUtils.getCollectionIndexedValue(bean, collectionIndex); } else { String expression = String.format("%s[%s]", pd.getName(), hierarchyElement.getIndex()); hierarchyValue = MappingUtils.getXPathIndexedValue(parentObj, expression);
if (!MappingUtils.isBlankOrNull(hierarchyElement.getIndex())) { Object bean = ReflectionUtils.invoke(pd.getReadMethod(), hierarchyValue, null); if (MappingUtils.isSimpleCollectionIndex(hierarchyElement.getIndex())) { int collectionIndex = MappingUtils.getCollectionIndex(hierarchyElement.getIndex()); hierarchyValue = MappingUtils.getCollectionIndexedValue(bean, collectionIndex); } else { String expression = String.format("%s[%s]", pd.getName(), hierarchyElement.getIndex()); hierarchyValue = MappingUtils.getXPathIndexedValue(parentObj, expression);
if (clazz.isArray()) { o = MappingUtils.prepareIndexedCollection(clazz, null, DestBeanCreator.create(clazz.getComponentType()), hierarchyElement.getIndex()); } else if (Collection.class.isAssignableFrom(clazz)) { .getIndex()); } else { try { if (currentSize < hierarchyElement.getIndex() + 1) { collectionEntryType = pd.getPropertyType().getComponentType(); value = MappingUtils.prepareIndexedCollection(pd.getPropertyType(), value, DestBeanCreator.create(collectionEntryType), hierarchyElement.getIndex()); parentObj = Array.get(value, hierarchyElement.getIndex()); } else if (value != null && Collection.class.isAssignableFrom(value.getClass())) { parentObj = MappingUtils.getIndexedValue(value, hierarchyElement.getIndex()); } else { parentObj = value;
String index = hierarchyElement.getIndex(); if (!MappingUtils.isSimpleCollectionIndex(index)) { MappingUtils.throwMappingException(String.format( String index = hierarchyElement.getIndex(); String index = hierarchyElement.getIndex(); if (!MappingUtils.isSimpleCollectionIndex(index)) { MappingUtils.throwMappingException("Destination field path should not contain filter expressions");
String index = hierarchyElement.getIndex(); if (!MappingUtils.isSimpleCollectionIndex(index)) { MappingUtils.throwMappingException(String.format( String index = hierarchyElement.getIndex(); String index = hierarchyElement.getIndex(); if (!MappingUtils.isSimpleCollectionIndex(index)) { MappingUtils.throwMappingException("Destination field path should not contain filter expressions");