Search in sources :

Example 26 with XMLCompositeDirectCollectionMapping

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;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLCompositeDirectCollectionMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping)

Example 27 with XMLCompositeDirectCollectionMapping

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;
}
Also used : XMLField(org.eclipse.persistence.oxm.XMLField) XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) NamespaceResolver(org.eclipse.persistence.oxm.NamespaceResolver) XMLCompositeDirectCollectionMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping)

Example 28 with XMLCompositeDirectCollectionMapping

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;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) XMLCompositeDirectCollectionMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping)

Example 29 with XMLCompositeDirectCollectionMapping

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;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) XMLCompositeDirectCollectionMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping)

Example 30 with XMLCompositeDirectCollectionMapping

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;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) XMLCompositeDirectCollectionMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping)

Aggregations

XMLCompositeDirectCollectionMapping (org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping)63 XMLDescriptor (org.eclipse.persistence.oxm.XMLDescriptor)49 XMLDirectMapping (org.eclipse.persistence.oxm.mappings.XMLDirectMapping)40 XMLField (org.eclipse.persistence.oxm.XMLField)14 XMLCompositeCollectionMapping (org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping)11 XMLCompositeObjectMapping (org.eclipse.persistence.oxm.mappings.XMLCompositeObjectMapping)11 NamespaceResolver (org.eclipse.persistence.oxm.NamespaceResolver)10 QName (javax.xml.namespace.QName)6 DatabaseMapping (org.eclipse.persistence.mappings.DatabaseMapping)6 ClassDescriptor (org.eclipse.persistence.descriptors.ClassDescriptor)3 DescriptorException (org.eclipse.persistence.exceptions.DescriptorException)3 JAXBException (org.eclipse.persistence.exceptions.JAXBException)3 DatabaseField (org.eclipse.persistence.internal.helper.DatabaseField)3 JAXBArrayAttributeAccessor (org.eclipse.persistence.internal.jaxb.many.JAXBArrayAttributeAccessor)3 Field (org.eclipse.persistence.internal.oxm.mappings.Field)3 JavaClass (org.eclipse.persistence.jaxb.javamodel.JavaClass)3 BigDecimal (java.math.BigDecimal)2 CoreDescriptor (org.eclipse.persistence.core.descriptors.CoreDescriptor)2 CoreMapping (org.eclipse.persistence.core.mappings.CoreMapping)2 CoreConverter (org.eclipse.persistence.core.mappings.converters.CoreConverter)2