Search in sources :

Example 16 with XMLCompositeDirectCollectionMapping

use of org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping in project eclipselink by eclipse-ee4j.

the class XMLSessionConfigProject method buildStructConverterConfigDescriptor.

public ClassDescriptor buildStructConverterConfigDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(StructConverterConfig.class);
    XMLCompositeDirectCollectionMapping convertersMapping = new XMLCompositeDirectCollectionMapping();
    convertersMapping.setAttributeName("m_structConverterClasses");
    convertersMapping.setGetMethodName("getStructConverterClasses");
    convertersMapping.setSetMethodName("setStructConverterClasses");
    convertersMapping.setXPath("struct-converter/text()");
    descriptor.addMapping(convertersMapping);
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLCompositeDirectCollectionMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping)

Example 17 with XMLCompositeDirectCollectionMapping

use of org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping in project eclipselink by eclipse-ee4j.

the class ObjectPersistenceWorkbenchXMLProject method buildInterfacePolicyDescriptor.

@Override
protected ClassDescriptor buildInterfacePolicyDescriptor() {
    ClassDescriptor descriptor = super.buildInterfacePolicyDescriptor();
    XMLCompositeDirectCollectionMapping referenceClassMapping = (XMLCompositeDirectCollectionMapping) descriptor.getMappingForAttributeName("parentInterfaces");
    referenceClassMapping.setGetMethodName("getParentInterfaceNames");
    referenceClassMapping.setSetMethodName("setParentInterfaceNames");
    XMLDirectMapping implementorDescriptorMapping = (XMLDirectMapping) descriptor.getMappingForAttributeName("implementorDescriptor");
    implementorDescriptorMapping.setGetMethodName("getImplementorDescriptorClassName");
    implementorDescriptorMapping.setSetMethodName("setImplementorDescriptorClassName");
    return descriptor;
}
Also used : ClassDescriptor(org.eclipse.persistence.descriptors.ClassDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) XMLCompositeDirectCollectionMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping)

Example 18 with XMLCompositeDirectCollectionMapping

use of org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping in project eclipselink by eclipse-ee4j.

the class WithoutGroupingElementIdentifiedByNameProject 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("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 19 with XMLCompositeDirectCollectionMapping

use of org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping in project eclipselink by eclipse-ee4j.

the class SimpleUnionPositionalXMLAttributeProject method getPersonDescriptor.

private XMLDescriptor getPersonDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Person.class);
    descriptor.setDefaultRootElement("person");
    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);
    XMLCompositeDirectCollectionMapping itemsMapping = new XMLCompositeDirectCollectionMapping();
    itemsMapping.setAttributeName("items");
    itemsMapping.setGetMethodName("getItems");
    itemsMapping.setSetMethodName("setItems");
    itemsMapping.useCollectionClass(java.util.ArrayList.class);
    XMLUnionField field = new XMLUnionField("items[1]/@item");
    QName dateQname = new QName(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI, "date");
    QName integerQName = new QName(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI, "integer");
    field.addSchemaType(dateQname);
    field.addSchemaType(integerQName);
    itemsMapping.setField(field);
    descriptor.addMapping(itemsMapping);
    XMLDirectMapping firstNameMapping = new XMLDirectMapping();
    firstNameMapping.setAttributeName("firstName");
    firstNameMapping.setXPath("first-name/text()");
    descriptor.addMapping(firstNameMapping);
    XMLDirectMapping lastNameMapping = new XMLDirectMapping();
    lastNameMapping.setAttributeName("lastName");
    lastNameMapping.setXPath("last-name/text()");
    descriptor.addMapping(lastNameMapping);
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) QName(javax.xml.namespace.QName) NamespaceResolver(org.eclipse.persistence.oxm.NamespaceResolver) XMLCompositeDirectCollectionMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping) XMLUnionField(org.eclipse.persistence.oxm.XMLUnionField)

Example 20 with XMLCompositeDirectCollectionMapping

use of org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping in project eclipselink by eclipse-ee4j.

the class DirectCollectionWithGroupingElementIdentifiedByPositionProject 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("responsibilities[1]/list/responsibility/text()");
    descriptor.addMapping(responsibilitiesMapping);
    XMLCompositeDirectCollectionMapping responsibilitiesMapping2 = new XMLCompositeDirectCollectionMapping();
    responsibilitiesMapping2.setAttributeName("outdoorResponsibilities");
    responsibilitiesMapping2.setXPath("responsibilities[2]/list/responsibility/text()");
    descriptor.addMapping(responsibilitiesMapping2);
    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