use of org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping in project eclipselink by eclipse-ee4j.
the class XMLSessionConfigProject method buildSessionEventManagerConfigDescriptor.
public ClassDescriptor buildSessionEventManagerConfigDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(SessionEventManagerConfig.class);
XMLCompositeDirectCollectionMapping sessionEventListenersMapping = new XMLCompositeDirectCollectionMapping();
sessionEventListenersMapping.setAttributeName("m_sessionEventListeners");
sessionEventListenersMapping.setGetMethodName("getSessionEventListeners");
sessionEventListenersMapping.setSetMethodName("setSessionEventListeners");
sessionEventListenersMapping.setXPath("event-listener-class/text()");
descriptor.addMapping(sessionEventListenersMapping);
return descriptor;
}
use of org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping in project eclipselink by eclipse-ee4j.
the class SimpleUnionProject method getPersonDescriptor.
private XMLDescriptor getPersonDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(Person.class);
descriptor.setDefaultRootElement("person");
NamespaceResolver resolver = new NamespaceResolver();
resolver.put(XMLConstants.SCHEMA_INSTANCE_PREFIX, javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
resolver.put(XMLConstants.SCHEMA_PREFIX, javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI);
descriptor.setNamespaceResolver(resolver);
XMLCompositeDirectCollectionMapping itemsMapping = new XMLCompositeDirectCollectionMapping();
itemsMapping.setAttributeName("items");
itemsMapping.setGetMethodName("getItems");
itemsMapping.setSetMethodName("setItems");
itemsMapping.useCollectionClass(java.util.ArrayList.class);
XMLUnionField field = new XMLUnionField("item/text()");
QName dateQname = new QName(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI, "date");
QName integerQName = new QName(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI, "integer");
field.addSchemaType(dateQname);
field.addSchemaType(integerQName);
itemsMapping.setField(field);
descriptor.addMapping(itemsMapping);
XMLDirectMapping firstNameMapping = new XMLDirectMapping();
firstNameMapping.setAttributeName("firstName");
firstNameMapping.setXPath("first-name/text()");
descriptor.addMapping(firstNameMapping);
XMLDirectMapping lastNameMapping = new XMLDirectMapping();
lastNameMapping.setAttributeName("lastName");
lastNameMapping.setXPath("last-name/text()");
descriptor.addMapping(lastNameMapping);
return descriptor;
}
use of org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping in project eclipselink by eclipse-ee4j.
the class SimpleUnionXMLAttributeProject method getPersonDescriptor.
private XMLDescriptor getPersonDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(Person.class);
descriptor.setDefaultRootElement("person");
NamespaceResolver resolver = new NamespaceResolver();
resolver.put(XMLConstants.SCHEMA_INSTANCE_PREFIX, javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
resolver.put(XMLConstants.SCHEMA_PREFIX, javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI);
descriptor.setNamespaceResolver(resolver);
XMLCompositeDirectCollectionMapping itemsMapping = new XMLCompositeDirectCollectionMapping();
itemsMapping.setAttributeName("items");
itemsMapping.setGetMethodName("getItems");
itemsMapping.setSetMethodName("setItems");
itemsMapping.useCollectionClass(java.util.ArrayList.class);
XMLUnionField field = new XMLUnionField("items/@item");
QName dateQname = new QName(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI, "date");
QName integerQName = new QName(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI, "integer");
field.addSchemaType(dateQname);
field.addSchemaType(integerQName);
itemsMapping.setField(field);
descriptor.addMapping(itemsMapping);
XMLDirectMapping firstNameMapping = new XMLDirectMapping();
firstNameMapping.setAttributeName("firstName");
firstNameMapping.setXPath("first-name/text()");
descriptor.addMapping(firstNameMapping);
XMLDirectMapping lastNameMapping = new XMLDirectMapping();
lastNameMapping.setAttributeName("lastName");
lastNameMapping.setXPath("last-name/text()");
descriptor.addMapping(lastNameMapping);
return descriptor;
}
use of org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping in project eclipselink by eclipse-ee4j.
the class DirectCollectionSingleNodeProject method getEmployeeDescriptor.
private XMLDescriptor getEmployeeDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(Employee.class);
descriptor.setDefaultRootElement("employee");
XMLDirectMapping idMapping = new XMLDirectMapping();
idMapping.setAttributeName("id");
idMapping.setXPath("@id");
descriptor.addMapping(idMapping);
XMLCompositeDirectCollectionMapping responsibilitiesMapping = new XMLCompositeDirectCollectionMapping();
responsibilitiesMapping.setAttributeName("responsibilities");
responsibilitiesMapping.useCollectionClass(ArrayList.class);
responsibilitiesMapping.setXPath("responsibilities/text()");
responsibilitiesMapping.setUsesSingleNode(true);
descriptor.addMapping(responsibilitiesMapping);
return descriptor;
}
use of org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping in project eclipselink by eclipse-ee4j.
the class RootProject method getRootDescriptor.
private XMLDescriptor getRootDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(Root.class);
descriptor.setDefaultRootElement("root");
XMLCompositeDirectCollectionMapping itemsMapping = new XMLCompositeDirectCollectionMapping();
itemsMapping.setAttributeName("items");
itemsMapping.setXPath("item/text()");
itemsMapping.setFieldElementClass(ArrayList.class);
itemsMapping.useCollectionClass(ArrayList.class);
XMLListConverter listConverter = new XMLListConverter();
listConverter.setObjectClass(Double.class);
itemsMapping.setValueConverter(listConverter);
descriptor.addMapping(itemsMapping);
return descriptor;
}
Aggregations