DirectCollectionMapping mapping = (DirectCollectionMapping)next;
XMLField field = (XMLField)mapping.getField();
XPathFragment frag = field.getXPathFragment();
List<String> enumeration = null;
if(mapping.getValueConverter() instanceof JAXBEnumTypeConverter) {
JAXBEnumTypeConverter conv = (JAXBEnumTypeConverter)mapping.getValueConverter();
enumeration = new ArrayList<String>();
for(Object nextValue: conv.getAttributeToFieldValues().values()) {
enumeration.add(nextValue.toString());
}
}
String propertyName = getNameForFragment(frag);
if(frag.nameIsText()) {
propertyName = (String)this.contextProperties.get(MarshallerProperties.JSON_VALUE_WRAPPER);
}
if(frag.isAttribute() && this.attributePrefix != null) {
propertyName = attributePrefix + propertyName;
}
prop = properties.get(propertyName);
if(prop == null) {
prop = new Property();
prop.setName(propertyName);
}
Property nestedProperty = getNestedPropertyForFragment(frag, prop);
nestedProperty.setType(JsonType.ARRAY);
nestedProperty.setItem(new Property());
if(enumeration != null) {
nestedProperty.getItem().setEnumeration(enumeration);
}
Class type = mapping.getAttributeElementClass();
if(type == null) {
type = CoreClassConstants.STRING;
}
nestedProperty.getItem().setType(getJsonTypeForJavaType(type));
return prop;
} else if(next instanceof BinaryDataCollectionMapping) {
BinaryDataCollectionMapping mapping = (BinaryDataCollectionMapping)next;
XMLField field = (XMLField)mapping.getField();
XPathFragment frag = field.getXPathFragment();
String propertyName = getNameForFragment(frag);
if(frag.nameIsText()) {
propertyName = (String)this.contextProperties.get(MarshallerProperties.JSON_VALUE_WRAPPER);
}
if(frag.isAttribute() && this.attributePrefix != null) {
propertyName = attributePrefix + propertyName;
}
prop = properties.get(propertyName);
if(prop == null) {
prop = new Property();
prop.setName(propertyName);
}
Property nestedProperty = getNestedPropertyForFragment(frag, prop);
nestedProperty.setType(JsonType.ARRAY);
nestedProperty.setItem(new Property());
if(mapping.shouldInlineBinaryData()) {
nestedProperty.getItem().setType(JsonType.STRING);
} else {
nestedProperty.getItem().setAnyOf(getXopIncludeProperties());
}
return prop;
}
} else {
if(next.isAbstractDirectMapping()) {
//handle direct mapping
DirectMapping directMapping = (DirectMapping)next;
XMLField field = (XMLField)directMapping.getField();
XPathFragment frag = field.getXPathFragment();
List<String> enumeration = null;
if(directMapping.getConverter() instanceof JAXBEnumTypeConverter) {
JAXBEnumTypeConverter conv = (JAXBEnumTypeConverter)directMapping.getConverter();
enumeration = new ArrayList<String>();
for(Object nextValue: conv.getAttributeToFieldValues().values()) {
enumeration.add(nextValue.toString());
}
}
String propertyName = getNameForFragment(frag);
if(frag.nameIsText()) {