// if the value type is something we have a descriptor for, create
// a composite mapping
if (typeInfo.containsKey(valueType.getQualifiedName())) {
if (isCollectionType(property)) {
mapping = generateCompositeCollectionMapping(property, descriptor, namespaceInfo, valueType.getQualifiedName());
((XMLCompositeCollectionMapping) mapping).setConverter(new XMLJavaTypeConverter(adapterClass.getQualifiedName()));
} else {
mapping = generateCompositeObjectMapping(property, descriptor, namespaceInfo, valueType.getQualifiedName());
((XMLCompositeObjectMapping) mapping).setConverter(new XMLJavaTypeConverter(adapterClass.getQualifiedName()));
}
} else {
// no descriptor for value type
if (property.isAny()) {
if (isCollectionType(property)){
mapping = generateAnyCollectionMapping(property, descriptor, namespaceInfo, property.isMixedContent());
((XMLAnyCollectionMapping) mapping).setConverter(new XMLJavaTypeConverter(adapterClass.getQualifiedName()));
} else {
mapping = generateAnyObjectMapping(property, descriptor, namespaceInfo);
((XMLAnyObjectMapping) mapping).setConverter(new XMLJavaTypeConverter(adapterClass.getQualifiedName()));
}
} else if (isCollectionType(property) || isArray) {
if (property.isSwaAttachmentRef() || property.isMtomAttachment()) {
mapping = generateBinaryDataCollectionMapping(property, descriptor, namespaceInfo);
((XMLBinaryDataCollectionMapping) mapping).setValueConverter(new XMLJavaTypeConverter(adapterClass.getQualifiedName()));
} else{
mapping = generateDirectCollectionMapping(property, descriptor, namespaceInfo);
if(adapterClass.getQualifiedName().equals(CollapsedStringAdapter.class.getName())) {
((XMLCompositeDirectCollectionMapping)mapping).setCollapsingStringValues(true);
} else if(adapterClass.getQualifiedName().equals(NormalizedStringAdapter.class.getName())) {
((XMLCompositeDirectCollectionMapping)mapping).setNormalizingStringValues(true);
} else {
((XMLCompositeDirectCollectionMapping) mapping).setValueConverter(new XMLJavaTypeConverter(adapterClass.getQualifiedName()));
}
}
} else if (property.isSwaAttachmentRef() || property.isMtomAttachment()) {
mapping = generateBinaryMapping(property, descriptor, namespaceInfo);
((XMLBinaryDataMapping) mapping).setConverter(new XMLJavaTypeConverter(adapterClass.getQualifiedName()));
} else {
if (!property.isAttribute() && areEquals(valueType, Object.class)){
mapping = generateCompositeObjectMapping(property, descriptor, namespaceInfo, null);
((XMLCompositeObjectMapping)mapping).setKeepAsElementPolicy(UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT);
((XMLCompositeObjectMapping)mapping).setConverter(new XMLJavaTypeConverter(adapterClass.getQualifiedName()));
return mapping;
}
mapping = generateDirectMapping(property, descriptor, namespaceInfo);
if(adapterClass.getQualifiedName().equals(CollapsedStringAdapter.class.getName())) {
((XMLDirectMapping)mapping).setCollapsingStringValues(true);
} else if(adapterClass.getQualifiedName().equals(NormalizedStringAdapter.class.getName())) {
((XMLDirectMapping)mapping).setNormalizingStringValues(true);
} else {
((XMLDirectMapping) mapping).setConverter(new XMLJavaTypeConverter(adapterClass.getQualifiedName()));
}
}
}
return mapping;
}