Search in sources :

Example 41 with XMLSchemaClassPathReference

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

the class RootElementProject method getSportsCarDescriptor.

private XMLDescriptor getSportsCarDescriptor() {
    XMLDescriptor xmlDescriptor = new XMLDescriptor();
    xmlDescriptor.setJavaClass(SportsCar.class);
    // For this test each descriptor in the inheritance hierarchy must have
    // a different default root element.
    xmlDescriptor.setDefaultRootElement("sports-car");
    NamespaceResolver nsResolver = new NamespaceResolver();
    nsResolver.put("xsi", javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
    xmlDescriptor.setNamespaceResolver(nsResolver);
    xmlDescriptor.getInheritancePolicy().setParentClass(Car.class);
    XMLSchemaReference schemaReference = new XMLSchemaClassPathReference();
    schemaReference.setSchemaContext("/sports-car");
    xmlDescriptor.setSchemaReference(schemaReference);
    return xmlDescriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLSchemaReference(org.eclipse.persistence.oxm.schema.XMLSchemaReference) NamespaceResolver(org.eclipse.persistence.oxm.NamespaceResolver) XMLSchemaClassPathReference(org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference)

Example 42 with XMLSchemaClassPathReference

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

the class RootElementProject method getCarDescriptor.

private XMLDescriptor getCarDescriptor() {
    XMLDescriptor xmlDescriptor = new XMLDescriptor();
    xmlDescriptor.setJavaClass(Car.class);
    // For this test each descriptor in the inheritance hierarchy must have
    // a different default root element.
    xmlDescriptor.setDefaultRootElement("car");
    NamespaceResolver nsResolver = new NamespaceResolver();
    nsResolver.put("xsi", javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
    xmlDescriptor.setNamespaceResolver(nsResolver);
    xmlDescriptor.getInheritancePolicy().setParentClass(Vehicle.class);
    XMLSchemaReference schemaReference = new XMLSchemaClassPathReference();
    schemaReference.setSchemaContext("/car");
    xmlDescriptor.setSchemaReference(schemaReference);
    return xmlDescriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLSchemaReference(org.eclipse.persistence.oxm.schema.XMLSchemaReference) NamespaceResolver(org.eclipse.persistence.oxm.NamespaceResolver) XMLSchemaClassPathReference(org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference)

Example 43 with XMLSchemaClassPathReference

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

the class RootElementProject method getVehicleDescriptor.

private XMLDescriptor getVehicleDescriptor() {
    XMLDescriptor xmlDescriptor = new XMLDescriptor();
    xmlDescriptor.setJavaClass(Vehicle.class);
    // For this test each descriptor in the inheritance hierarchy must have
    // a different default root element.
    xmlDescriptor.setDefaultRootElement("vehicle");
    NamespaceResolver nsResolver = new NamespaceResolver();
    nsResolver.put("xsi", javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
    xmlDescriptor.setNamespaceResolver(nsResolver);
    xmlDescriptor.getInheritancePolicy().setClassIndicatorFieldName("@xsi:type");
    xmlDescriptor.getInheritancePolicy().addClassIndicator(Vehicle.class, "vehicle");
    xmlDescriptor.getInheritancePolicy().addClassIndicator(Car.class, "car");
    xmlDescriptor.getInheritancePolicy().addClassIndicator(SportsCar.class, "sports-car");
    XMLSchemaReference schemaReference = new XMLSchemaClassPathReference();
    schemaReference.setSchemaContext("/vehicle");
    xmlDescriptor.setSchemaReference(schemaReference);
    return xmlDescriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLSchemaReference(org.eclipse.persistence.oxm.schema.XMLSchemaReference) NamespaceResolver(org.eclipse.persistence.oxm.NamespaceResolver) XMLSchemaClassPathReference(org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference)

Example 44 with XMLSchemaClassPathReference

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

the class CompositeCollectionWithGroupingElementIdentifiedByNamespaceProject method getMailingAddressDescriptor.

private XMLDescriptor getMailingAddressDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(MailingAddress.class);
    descriptor.setNamespaceResolver(namespaceResolver);
    XMLDirectMapping streetMapping = new XMLDirectMapping();
    streetMapping.setAttributeName("street");
    streetMapping.setXPath(MAILING_PREFIX + ":street/text()");
    descriptor.addMapping(streetMapping);
    XMLDirectMapping cityMapping = new XMLDirectMapping();
    cityMapping.setAttributeName("city");
    cityMapping.setXPath(MAILING_PREFIX + ":city/text()");
    descriptor.addMapping(cityMapping);
    XMLDirectMapping provinceMapping = new XMLDirectMapping();
    provinceMapping.setAttributeName("province");
    provinceMapping.setXPath(MAILING_PREFIX + ":province/text()");
    descriptor.addMapping(provinceMapping);
    XMLDirectMapping postalCodeMapping = new XMLDirectMapping();
    postalCodeMapping.setAttributeName("postalCode");
    postalCodeMapping.setXPath(MAILING_PREFIX + ":postal-code/text()");
    descriptor.addMapping(postalCodeMapping);
    XMLSchemaClassPathReference schemaRef = new XMLSchemaClassPathReference();
    schemaRef.setSchemaContext("/mailing:addressType");
    schemaRef.setType(XMLSchemaClassPathReference.COMPLEX_TYPE);
    descriptor.setSchemaReference(schemaRef);
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) XMLSchemaClassPathReference(org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference)

Example 45 with XMLSchemaClassPathReference

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

the class CompositeObjectIdentifiedByNameProject method getMailingAddressDescriptor.

private XMLDescriptor getMailingAddressDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(MailingAddress.class);
    XMLDirectMapping streetMapping = new XMLDirectMapping();
    streetMapping.setAttributeName("street");
    streetMapping.setXPath("street/text()");
    descriptor.addMapping(streetMapping);
    XMLDirectMapping cityMapping = new XMLDirectMapping();
    cityMapping.setAttributeName("city");
    cityMapping.setXPath("city/text()");
    descriptor.addMapping(cityMapping);
    XMLDirectMapping provinceMapping = new XMLDirectMapping();
    provinceMapping.setAttributeName("province");
    provinceMapping.setXPath("province/text()");
    descriptor.addMapping(provinceMapping);
    XMLDirectMapping postalCodeMapping = new XMLDirectMapping();
    postalCodeMapping.setAttributeName("postalCode");
    postalCodeMapping.setXPath("postal-code/text()");
    descriptor.addMapping(postalCodeMapping);
    XMLSchemaClassPathReference schemaRef = new XMLSchemaClassPathReference();
    schemaRef.setSchemaContext("/mailingAddressType");
    schemaRef.setType(XMLSchemaClassPathReference.COMPLEX_TYPE);
    descriptor.setSchemaReference(schemaRef);
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) 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