}
}
if (null == childObject) {
childObject = mapping.getReferenceDescriptor().getObjectBuilder().buildNewInstance();
}
CoreObjectBuilder childObjectBuilder = mapping.getReferenceDescriptor().getObjectBuilder();
return getMappingForXPath(childObject, childObjectBuilder, stringTokenizer, namespaceResolver);
}
}
}
} else {
if (!stringTokenizer.hasMoreElements()) {
// End of the line, we found a mapping so return it
queryResult.mapping = mapping;
queryResult.owner = object;
return queryResult;
} else {
// We need to keep looking -- get the mapping value,
// then recurse into getMappingForXPath with new root object
Object childObject = mapping.getAttributeValueFromObject(object);
if (mapping.isCollectionMapping()) {
Object collection = mapping.getAttributeValueFromObject(object);
if (null != collection && List.class.isAssignableFrom(collection.getClass())) {
List list = (List) collection;
if (0 >= list.size()) {
return null;
}
childObject = list.get(0);
}
}
if (null == childObject) {
childObject = mapping.getReferenceDescriptor().getObjectBuilder().buildNewInstance();
}
CoreObjectBuilder childObjectBuilder = mapping.getReferenceDescriptor().getObjectBuilder();
return getMappingForXPath(childObject, childObjectBuilder, stringTokenizer, namespaceResolver);
}
}
xPath = xPath + nextToken + Constants.XPATH_SEPARATOR;
}