use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.
the class EmployeeProject method getEmployeeDescriptor.
XMLDescriptor getEmployeeDescriptor() {
XMLDescriptor xmlDescriptor = new XMLDescriptor();
xmlDescriptor.setJavaClass(Employee.class);
xmlDescriptor.setDefaultRootElement("employee");
xmlDescriptor.setNamespaceResolver(namespaceResolver);
xmlDescriptor.getInheritancePolicy().setParentClass(Person.class);
XMLDirectMapping mapping = new XMLDirectMapping();
mapping.setAttributeName("jobTitle");
mapping.setXPath("text()");
xmlDescriptor.addMapping(mapping);
XMLSchemaClassPathReference schemaReference = new XMLSchemaClassPathReference();
schemaReference.setSchemaContext("/employee");
schemaReference.setType(XMLSchemaClassPathReference.COMPLEX_TYPE);
xmlDescriptor.setSchemaReference(schemaReference);
return xmlDescriptor;
}
use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.
the class RootElementIdentifiedByNameProject method buildEmailAddressDescriptor.
private XMLDescriptor buildEmailAddressDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(EmailAddress.class);
descriptor.setDefaultRootElement("email-address");
XMLSchemaClassPathReference schemaReference = new XMLSchemaClassPathReference();
schemaReference.setSchemaContext("/emailType");
descriptor.setSchemaReference(schemaReference);
return descriptor;
}
use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.
the class RootElementIdentifiedByNameProject method buildMailingAddressDescriptor.
private XMLDescriptor buildMailingAddressDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(MailingAddress.class);
descriptor.setDefaultRootElement("mailing-address");
XMLSchemaClassPathReference schemaReference = new XMLSchemaClassPathReference();
schemaReference.setSchemaContext("/mailingType");
descriptor.setSchemaReference(schemaReference);
return descriptor;
}
use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.
the class CompositeObjectSelfNoRefClassProject method getAddressDescriptor.
protected XMLDescriptor getAddressDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(Address.class);
descriptor.setDefaultRootElement("address");
XMLDirectMapping streetMapping = new XMLDirectMapping();
streetMapping.setAttributeName("street");
streetMapping.setXPath("street/text()");
descriptor.addMapping(streetMapping);
XMLSchemaClassPathReference schemaReference = new XMLSchemaClassPathReference();
schemaReference.setSchemaContext("/addressType");
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 XMLRootComplexProject method getPersonDescriptor.
private XMLDescriptor getPersonDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(Person.class);
XMLDirectMapping nameMapping = new XMLDirectMapping();
nameMapping.setAttributeName("name");
nameMapping.setGetMethodName("getName");
nameMapping.setSetMethodName("setName");
nameMapping.setXPath("name/text()");
descriptor.addMapping(nameMapping);
XMLSchemaClassPathReference schemaReference = new XMLSchemaClassPathReference();
schemaReference.setSchemaContext("/oxm:person");
schemaReference.setType(XMLSchemaClassPathReference.COMPLEX_TYPE);
descriptor.setSchemaReference(schemaReference);
namespaceResolver.put("oxm", "test");
descriptor.setNamespaceResolver(namespaceResolver);
return descriptor;
}
Aggregations