property.setXmlStyle(Property.XmlStyle.ATTRIBUTE);
property.setXmlName(attributeProperty.getXmlName());
property.setRequired(attributeProperty.isRequired());
if (property.isCollection()) property.setXmlList(true);
} else if (runtimePropertyInfo instanceof RuntimeElementPropertyInfo) {
RuntimeElementPropertyInfo elementProperty = (RuntimeElementPropertyInfo) runtimePropertyInfo;
property.setXmlStyle(Property.XmlStyle.ELEMENT);
if (!elementProperty.isValueList()) {
property.setXmlName(elementProperty.getXmlName());
for (RuntimeTypeRef typeRef : elementProperty.getTypes()) {
ElementMapping elementMapping = createXmlMapping(property, typeRef);
property.getElementMappings().add(elementMapping);
}
property.setRequired(elementProperty.isRequired());
property.setNillable(elementProperty.isCollectionNillable());
} else {
property.setXmlList(true);
if (elementProperty.getTypes().size() != 1) throw new BuildException("Expected 1 element mapped to property " + property + " but there are " + elementProperty.getTypes().size() + " mappings");
RuntimeTypeRef elementType = elementProperty.getTypes().get(0);
ElementMapping elementMapping = createXmlMapping(property, elementType);
elementMapping.setNillable(false);
property.getElementMappings().add(elementMapping);
property.setXmlName(elementType.getTagName());