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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations