use of org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping in project eclipselink by eclipse-ee4j.
the class AttributeListOnTargetTestProject method getAddressDescriptor.
@Override
public XMLDescriptor getAddressDescriptor() {
XMLDescriptor xmlDescriptor = super.getAddressDescriptor();
XMLCompositeDirectCollectionMapping collectionMapping = new XMLCompositeDirectCollectionMapping();
collectionMapping.setAttributeName("provinces");
collectionMapping.setXPath("@provinces");
collectionMapping.setUsesSingleNode(true);
xmlDescriptor.addMapping(collectionMapping);
return xmlDescriptor;
}
use of org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping in project eclipselink by eclipse-ee4j.
the class WithGroupingElementIdentifiedByNameProject method getEmployeeDescriptor.
private XMLDescriptor getEmployeeDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(Employee.class);
descriptor.setDefaultRootElement("employee");
NamespaceResolver resolver = new NamespaceResolver();
resolver.put(XMLConstants.SCHEMA_INSTANCE_PREFIX, javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
resolver.put(XMLConstants.SCHEMA_PREFIX, javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI);
descriptor.setNamespaceResolver(resolver);
XMLDirectMapping idMapping = new XMLDirectMapping();
idMapping.setAttributeName("id");
idMapping.setXPath("@id");
descriptor.addMapping(idMapping);
XMLCompositeDirectCollectionMapping responsibilitiesMapping = new XMLCompositeDirectCollectionMapping();
responsibilitiesMapping.setAttributeName("responsibilities");
XMLField field = new XMLField("responsibilities/list/responsibility/text()");
field.setIsTypedTextField(true);
responsibilitiesMapping.setField(field);
descriptor.addMapping(responsibilitiesMapping);
return descriptor;
}
use of org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping in project eclipselink by eclipse-ee4j.
the class DirectCollectionArrayListProject method getEmployeeDescriptor.
private XMLDescriptor getEmployeeDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(Employee.class);
descriptor.setDefaultRootElement("employee");
XMLDirectMapping idMapping = new XMLDirectMapping();
idMapping.setAttributeName("id");
idMapping.setXPath("@id");
descriptor.addMapping(idMapping);
XMLCompositeDirectCollectionMapping responsibilitiesMapping = new XMLCompositeDirectCollectionMapping();
responsibilitiesMapping.setAttributeName("responsibilities");
responsibilitiesMapping.useCollectionClass(ArrayList.class);
responsibilitiesMapping.setXPath("responsibilities/list/responsibility/text()");
descriptor.addMapping(responsibilitiesMapping);
return descriptor;
}
use of org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping in project eclipselink by eclipse-ee4j.
the class DirectCollectionArrayListXMLAttributeProject method getEmployeeDescriptor.
private XMLDescriptor getEmployeeDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(Employee.class);
descriptor.setDefaultRootElement("employee");
XMLDirectMapping idMapping = new XMLDirectMapping();
idMapping.setAttributeName("id");
idMapping.setXPath("@id");
descriptor.addMapping(idMapping);
XMLCompositeDirectCollectionMapping responsibilitiesMapping = new XMLCompositeDirectCollectionMapping();
responsibilitiesMapping.setAttributeName("responsibilities");
responsibilitiesMapping.useCollectionClass(ArrayList.class);
responsibilitiesMapping.setXPath("responsibilities/list/@responsibility");
descriptor.addMapping(responsibilitiesMapping);
return descriptor;
}
use of org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping in project eclipselink by eclipse-ee4j.
the class DirectCollectionWithoutGroupingElementIdentifiedByNameProject method getEmployeeDescriptor.
private XMLDescriptor getEmployeeDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(Employee.class);
descriptor.setDefaultRootElement("employee");
XMLDirectMapping idMapping = new XMLDirectMapping();
idMapping.setAttributeName("id");
idMapping.setXPath("@id");
descriptor.addMapping(idMapping);
XMLCompositeDirectCollectionMapping responsibilitiesMapping = new XMLCompositeDirectCollectionMapping();
responsibilitiesMapping.setAttributeName("responsibilities");
responsibilitiesMapping.setXPath("responsibility/text()");
descriptor.addMapping(responsibilitiesMapping);
return descriptor;
}
Aggregations