use of org.eclipse.persistence.internal.oxm.XMLChoiceFieldToClassAssociation in project eclipselink by eclipse-ee4j.
the class XMLChoiceCollectionMapping method getChoiceFieldToClassAssociations.
@Override
public ArrayList getChoiceFieldToClassAssociations() {
ArrayList associations = new ArrayList();
if (this.fieldToClassNameMappings.size() > 0) {
Set<Entry<XMLField, String>> entries = fieldToClassNameMappings.entrySet();
Iterator<Entry<XMLField, String>> iter = entries.iterator();
while (iter.hasNext()) {
Entry<XMLField, String> nextEntry = iter.next();
XMLField xmlField = nextEntry.getKey();
String className = nextEntry.getValue();
XMLChoiceFieldToClassAssociation association = new XMLChoiceFieldToClassAssociation(xmlField, className);
associations.add(association);
}
}
return associations;
}
use of org.eclipse.persistence.internal.oxm.XMLChoiceFieldToClassAssociation in project eclipselink by eclipse-ee4j.
the class XMLChoiceObjectMapping method getChoiceFieldToClassAssociations.
@Override
public ArrayList getChoiceFieldToClassAssociations() {
ArrayList associations = new ArrayList();
if (this.fieldToClassNameMappings.size() > 0) {
Set<Entry<XMLField, String>> entries = fieldToClassNameMappings.entrySet();
Iterator<Entry<XMLField, String>> iter = entries.iterator();
while (iter.hasNext()) {
Entry<XMLField, String> nextEntry = iter.next();
XMLField xmlField = nextEntry.getKey();
String className = nextEntry.getValue();
XMLChoiceFieldToClassAssociation association = new XMLChoiceFieldToClassAssociation(xmlField, className);
associations.add(association);
}
}
return associations;
}
use of org.eclipse.persistence.internal.oxm.XMLChoiceFieldToClassAssociation in project eclipselink by eclipse-ee4j.
the class SchemaModelGenerator method processChoiceMapping.
/**
* Process a given XMLChoiceMapping.
*/
protected void processChoiceMapping(Map<Field, Class<?>> fieldToClassMap, List<XMLChoiceFieldToClassAssociation> choiceFieldToClassList, Sequence seq, ComplexType ct, HashMap<String, Schema> schemaForNamespace, Schema workingSchema, SchemaModelGeneratorProperties properties, List<Descriptor> descriptors, boolean isCollection) {
Choice theChoice = new Choice();
if (isCollection) {
theChoice.setMaxOccurs(Occurs.UNBOUNDED);
}
for (XMLChoiceFieldToClassAssociation next : choiceFieldToClassList) {
Field field = next.getXmlField();
Element element = buildElement(field.getXPathFragment().getShortName(), Occurs.ZERO, null);
QName schemaTypeQName = field.getSchemaType();
if (schemaTypeQName != null) {
element.setType(getSchemaTypeString(schemaTypeQName, workingSchema));
} else {
element = processReferenceDescriptor(element, getDescriptorByClass(fieldToClassMap.get(field), descriptors), schemaForNamespace, workingSchema, properties, descriptors, field, false);
}
theChoice.addElement(element);
}
seq.addChoice(theChoice);
}
Aggregations