use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.
the class ChildAndGeneratedPrefixClashProject method getTeamDescriptor.
private XMLDescriptor getTeamDescriptor() {
XMLDescriptor xmlDescriptor = new XMLDescriptor();
xmlDescriptor.setJavaClass(Team.class);
xmlDescriptor.setDefaultRootElement("aaa:team");
XMLDirectMapping nameMapping = new XMLDirectMapping();
nameMapping.setAttributeName("teamName");
nameMapping.setXPath("ns0:teamName/text()");
xmlDescriptor.addMapping(nameMapping);
XMLSchemaClassPathReference ref = new XMLSchemaClassPathReference();
ref.setSchemaContext("/aaa:team");
ref.setType(XMLSchemaClassPathReference.COMPLEX_TYPE);
xmlDescriptor.setSchemaReference(ref);
NamespaceResolver nsResolver = new NamespaceResolver();
nsResolver.put("aaa", "http://www.example.com/aaa");
nsResolver.put("ns0", "http://www.example.com/teamNS0");
nsResolver.put("ns1", "http://www.example.com/teamNS1");
xmlDescriptor.setNamespaceResolver(nsResolver);
return xmlDescriptor;
}
use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.
the class CompositeCollectionWithGroupingElementIdentifiedByNamespaceProject method getEmailAddressDescriptor.
private XMLDescriptor getEmailAddressDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(EmailAddress.class);
descriptor.setNamespaceResolver(namespaceResolver);
XMLDirectMapping userIDMapping = new XMLDirectMapping();
userIDMapping.setAttributeName("userID");
userIDMapping.setXPath(EMAIL_PREFIX + ":user-id/text()");
descriptor.addMapping(userIDMapping);
XMLDirectMapping domainMapping = new XMLDirectMapping();
domainMapping.setAttributeName("domain");
domainMapping.setXPath(EMAIL_PREFIX + ":domain/text()");
descriptor.addMapping(domainMapping);
XMLSchemaClassPathReference schemaRef = new XMLSchemaClassPathReference();
schemaRef.setSchemaContext("/email:addressType");
schemaRef.setType(XMLSchemaClassPathReference.COMPLEX_TYPE);
descriptor.setSchemaReference(schemaRef);
return descriptor;
}
use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.
the class CustomerProject method getAddressDescriptor.
private XMLDescriptor getAddressDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(Address.class);
NamespaceResolver nsResolver = new NamespaceResolver();
nsResolver.setDefaultNamespaceURI("urn:customer");
descriptor.setNamespaceResolver(nsResolver);
XMLSchemaClassPathReference schemaReference = new XMLSchemaClassPathReference();
schemaReference.setSchemaContext("/address-type");
schemaReference.setType(XMLSchemaClassPathReference.COMPLEX_TYPE);
descriptor.setSchemaReference(schemaReference);
return descriptor;
}
use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.
the class TypeProject method getAddressDescriptor.
public XMLDescriptor getAddressDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(Address.class);
descriptor.setDefaultRootElement("contact-method");
descriptor.setDefaultRootElementType(new QName("http://www.example.com/toplink-oxm", "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 AnyTypeProject method getCdnAddressDescriptor.
public XMLDescriptor getCdnAddressDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(CanadianAddress.class);
descriptor.setDefaultRootElement("contact-method");
descriptor.setDefaultRootElementType(new QName("http://www.example.com/toplink-oxm", "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;
}
Aggregations