Search in sources :

Example 36 with XMLSchemaClassPathReference

use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.

the class COMCollectionTypeProject method getCdnAddressDescriptor.

public XMLDescriptor getCdnAddressDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(CanadianAddress.class);
    descriptor.setDefaultRootElement("contact-method");
    descriptor.setDefaultRootElementType(new QName("contact-method-type"));
    descriptor.setNamespaceResolver(namespaceResolver);
    descriptor.getInheritancePolicy().setParentClass(Address.class);
    XMLSchemaClassPathReference ref = new XMLSchemaClassPathReference();
    ref.setSchemaContext("/oxm:canadian-address-type");
    ref.setType(XMLSchemaClassPathReference.COMPLEX_TYPE);
    descriptor.setSchemaReference(ref);
    XMLDirectMapping postalCodeMapping = new XMLDirectMapping();
    postalCodeMapping.setAttributeName("postalCode");
    postalCodeMapping.setXPath("postal-code/text()");
    descriptor.addMapping(postalCodeMapping);
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) QName(javax.xml.namespace.QName) XMLSchemaClassPathReference(org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference)

Example 37 with XMLSchemaClassPathReference

use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.

the class COMCollectionTypeProject method getAddressDescriptor.

public XMLDescriptor getAddressDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Address.class);
    descriptor.setDefaultRootElement("contact-method");
    descriptor.setDefaultRootElementType(new QName("contact-method-type"));
    descriptor.setNamespaceResolver(namespaceResolver);
    descriptor.getInheritancePolicy().setParentClass(ContactMethod.class);
    XMLSchemaClassPathReference ref = new XMLSchemaClassPathReference();
    ref.setSchemaContext("/address-type");
    ref.setType(XMLSchemaClassPathReference.COMPLEX_TYPE);
    descriptor.setSchemaReference(ref);
    XMLDirectMapping streetMapping = new XMLDirectMapping();
    streetMapping.setAttributeName("street");
    streetMapping.setXPath("street/text()");
    descriptor.addMapping(streetMapping);
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) QName(javax.xml.namespace.QName) XMLSchemaClassPathReference(org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference)

Example 38 with XMLSchemaClassPathReference

use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.

the class COMCollectionTypeProject method getContactMethodDescriptor.

public XMLDescriptor getContactMethodDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(ContactMethod.class);
    descriptor.setDefaultRootElement("contact-method");
    descriptor.setDefaultRootElementType(new QName("contact-method-type"));
    descriptor.setNamespaceResolver(namespaceResolver);
    XMLSchemaClassPathReference ref = new XMLSchemaClassPathReference();
    ref.setSchemaContext("/contact-method-type");
    ref.setType(XMLSchemaClassPathReference.COMPLEX_TYPE);
    descriptor.setSchemaReference(ref);
    XMLField classIndicatorField = new XMLField("@xsi:type");
    descriptor.getInheritancePolicy().setClassIndicatorField(classIndicatorField);
    descriptor.getInheritancePolicy().addClassIndicator(ContactMethod.class, "contact-method-type");
    descriptor.getInheritancePolicy().addClassIndicator(Address.class, "address-type");
    descriptor.getInheritancePolicy().addClassIndicator(CanadianAddress.class, "oxm:canadian-address-type");
    descriptor.getInheritancePolicy().setShouldReadSubclasses(true);
    XMLDirectMapping idMapping = new XMLDirectMapping();
    idMapping.setAttributeName("id");
    idMapping.setXPath("id/text()");
    descriptor.addMapping(idMapping);
    return descriptor;
}
Also used : XMLField(org.eclipse.persistence.oxm.XMLField) XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) QName(javax.xml.namespace.QName) XMLSchemaClassPathReference(org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference)

Example 39 with XMLSchemaClassPathReference

use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.

the class AnyCollectionTypeProject method getAddressDescriptor.

public XMLDescriptor getAddressDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Address.class);
    descriptor.setDefaultRootElement("contact-method");
    descriptor.setDefaultRootElementType(new QName("contact-method-type"));
    descriptor.setNamespaceResolver(namespaceResolver);
    descriptor.getInheritancePolicy().setParentClass(ContactMethod.class);
    XMLSchemaClassPathReference ref = new XMLSchemaClassPathReference();
    ref.setSchemaContext("/address-type");
    ref.setType(XMLSchemaClassPathReference.COMPLEX_TYPE);
    descriptor.setSchemaReference(ref);
    XMLDirectMapping streetMapping = new XMLDirectMapping();
    streetMapping.setAttributeName("street");
    streetMapping.setXPath("street/text()");
    descriptor.addMapping(streetMapping);
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) QName(javax.xml.namespace.QName) XMLSchemaClassPathReference(org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference)

Example 40 with XMLSchemaClassPathReference

use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.

the class AnyCollectionTypeProject method getCdnAddressDescriptor.

public XMLDescriptor getCdnAddressDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(CanadianAddress.class);
    descriptor.setDefaultRootElement("contact-method");
    descriptor.setDefaultRootElementType(new QName("contact-method-type"));
    descriptor.setNamespaceResolver(namespaceResolver);
    descriptor.getInheritancePolicy().setParentClass(Address.class);
    XMLSchemaClassPathReference ref = new XMLSchemaClassPathReference();
    ref.setSchemaContext("/canadian-address-type");
    ref.setType(XMLSchemaClassPathReference.COMPLEX_TYPE);
    descriptor.setSchemaReference(ref);
    XMLDirectMapping postalCodeMapping = new XMLDirectMapping();
    postalCodeMapping.setAttributeName("postalCode");
    postalCodeMapping.setXPath("postal-code/text()");
    descriptor.addMapping(postalCodeMapping);
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) QName(javax.xml.namespace.QName) XMLSchemaClassPathReference(org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference)

Aggregations

XMLSchemaClassPathReference (org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference)71 XMLDescriptor (org.eclipse.persistence.oxm.XMLDescriptor)69 XMLDirectMapping (org.eclipse.persistence.oxm.mappings.XMLDirectMapping)52 NamespaceResolver (org.eclipse.persistence.oxm.NamespaceResolver)36 QName (javax.xml.namespace.QName)13 XMLCompositeCollectionMapping (org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping)9 XMLCompositeObjectMapping (org.eclipse.persistence.oxm.mappings.XMLCompositeObjectMapping)9 XMLField (org.eclipse.persistence.oxm.XMLField)8 XMLObjectReferenceMapping (org.eclipse.persistence.oxm.mappings.XMLObjectReferenceMapping)6 XMLSchemaReference (org.eclipse.persistence.oxm.schema.XMLSchemaReference)5 XMLCollectionReferenceMapping (org.eclipse.persistence.oxm.mappings.XMLCollectionReferenceMapping)4 XMLCompositeDirectCollectionMapping (org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping)2 XmlValue (jakarta.xml.bind.annotation.XmlValue)1 XMLAnyCollectionMapping (org.eclipse.persistence.oxm.mappings.XMLAnyCollectionMapping)1 XMLTransformationMapping (org.eclipse.persistence.oxm.mappings.XMLTransformationMapping)1