use of org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping in project eclipselink by eclipse-ee4j.
the class XMLSessionConfigProject method buildStructConverterConfigDescriptor.
public ClassDescriptor buildStructConverterConfigDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(StructConverterConfig.class);
XMLCompositeDirectCollectionMapping convertersMapping = new XMLCompositeDirectCollectionMapping();
convertersMapping.setAttributeName("m_structConverterClasses");
convertersMapping.setGetMethodName("getStructConverterClasses");
convertersMapping.setSetMethodName("setStructConverterClasses");
convertersMapping.setXPath("struct-converter/text()");
descriptor.addMapping(convertersMapping);
return descriptor;
}
use of org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping in project eclipselink by eclipse-ee4j.
the class ObjectPersistenceWorkbenchXMLProject method buildInterfacePolicyDescriptor.
@Override
protected ClassDescriptor buildInterfacePolicyDescriptor() {
ClassDescriptor descriptor = super.buildInterfacePolicyDescriptor();
XMLCompositeDirectCollectionMapping referenceClassMapping = (XMLCompositeDirectCollectionMapping) descriptor.getMappingForAttributeName("parentInterfaces");
referenceClassMapping.setGetMethodName("getParentInterfaceNames");
referenceClassMapping.setSetMethodName("setParentInterfaceNames");
XMLDirectMapping implementorDescriptorMapping = (XMLDirectMapping) descriptor.getMappingForAttributeName("implementorDescriptor");
implementorDescriptorMapping.setGetMethodName("getImplementorDescriptorClassName");
implementorDescriptorMapping.setSetMethodName("setImplementorDescriptorClassName");
return descriptor;
}
use of org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping in project eclipselink by eclipse-ee4j.
the class WithoutGroupingElementIdentifiedByNameProject method getEmployeeDescriptor.
private XMLDescriptor getEmployeeDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(Employee.class);
descriptor.setDefaultRootElement("employee");
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);
XMLDirectMapping idMapping = new XMLDirectMapping();
idMapping.setAttributeName("id");
idMapping.setXPath("@id");
descriptor.addMapping(idMapping);
XMLCompositeDirectCollectionMapping responsibilitiesMapping = new XMLCompositeDirectCollectionMapping();
responsibilitiesMapping.setAttributeName("responsibilities");
XMLField field = new XMLField("responsibility/text()");
field.setIsTypedTextField(true);
responsibilitiesMapping.setField(field);
descriptor.addMapping(responsibilitiesMapping);
return descriptor;
}
use of org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping in project eclipselink by eclipse-ee4j.
the class SimpleUnionPositionalXMLAttributeProject 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[1]/@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 DirectCollectionWithGroupingElementIdentifiedByPositionProject 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.setXPath("responsibilities[1]/list/responsibility/text()");
descriptor.addMapping(responsibilitiesMapping);
XMLCompositeDirectCollectionMapping responsibilitiesMapping2 = new XMLCompositeDirectCollectionMapping();
responsibilitiesMapping2.setAttributeName("outdoorResponsibilities");
responsibilitiesMapping2.setXPath("responsibilities[2]/list/responsibility/text()");
descriptor.addMapping(responsibilitiesMapping2);
return descriptor;
}
Aggregations