use of org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping in project eclipselink by eclipse-ee4j.
the class NillableTestProject method getNillableTestObjectDescriptor.
private XMLDescriptor getNillableTestObjectDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(NillableTestObject.class);
descriptor.setAlias("NillableTestObject");
descriptor.setDefaultRootElement("nillable-test-object");
XMLDirectMapping directMapping = new XMLDirectMapping();
directMapping.setAttributeName("direct");
directMapping.setXPath("direct/text()");
directMapping.getNullPolicy().setNullRepresentedByXsiNil(shouldSetMappingsToNillable);
descriptor.addMapping(directMapping);
XMLCompositeDirectCollectionMapping directCollectionMapping = new XMLCompositeDirectCollectionMapping();
directCollectionMapping.setAttributeName("directCollection");
directCollectionMapping.setXPath("directCollection/text()");
directCollectionMapping.getNullPolicy().setNullRepresentedByXsiNil(shouldSetMappingsToNillable);
descriptor.addMapping(directCollectionMapping);
XMLCompositeObjectMapping compositeObjectMapping = new XMLCompositeObjectMapping();
compositeObjectMapping.setAttributeName("compositeObject");
compositeObjectMapping.setXPath("compositeObject/text()");
compositeObjectMapping.setReferenceClass(NillableTestSubObject.class);
compositeObjectMapping.getNullPolicy().setNullRepresentedByXsiNil(shouldSetMappingsToNillable);
descriptor.addMapping(compositeObjectMapping);
XMLCompositeCollectionMapping compositeCollectionMapping = new XMLCompositeCollectionMapping();
compositeCollectionMapping.setAttributeName("compositeCollection");
compositeCollectionMapping.setXPath("compositeCollection/text()");
compositeCollectionMapping.setReferenceClass(NillableTestSubObject.class);
compositeCollectionMapping.getNullPolicy().setNullRepresentedByXsiNil(shouldSetMappingsToNillable);
descriptor.addMapping(compositeCollectionMapping);
return descriptor;
}
use of org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping in project eclipselink by eclipse-ee4j.
the class OneDirectCollectionMappingProject method addEmployeeDescriptor.
public void addEmployeeDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setDefaultRootElement("employee");
descriptor.setJavaClass(Employee.class);
XMLCompositeDirectCollectionMapping responsibilities = new XMLCompositeDirectCollectionMapping();
responsibilities.setAttributeName("primaryResponsibilities");
responsibilities.setXPath("primary-responsibilities/responsibility/text()");
responsibilities.getContainerPolicy().setContainerClass(Vector.class);
responsibilities.readOnly();
descriptor.addMapping(responsibilities);
this.addDescriptor(descriptor);
}
use of org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping in project eclipselink by eclipse-ee4j.
the class DocPreservationTestProject method buildEmployeeDescriptor.
public void buildEmployeeDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setDefaultRootElement("employee");
descriptor.setShouldPreserveDocument(true);
descriptor.setJavaClass(Employee.class);
descriptor.addDirectMapping("firstName", "getFirstName", "setFirstName", "first-name/text()");
XMLDirectMapping lname = new XMLDirectMapping();
lname.setAttributeName("lastName");
lname.setGetMethodName("getLastName");
lname.setSetMethodName("setLastName");
lname.setXPath("last-name/text()");
descriptor.addMapping(lname);
XMLCompositeObjectMapping addr = new XMLCompositeObjectMapping();
addr.setAttributeName("address");
addr.setGetMethodName("getAddress");
addr.setSetMethodName("setAddress");
addr.setXPath("address");
addr.setReferenceClass(Address.class);
descriptor.addMapping(addr);
XMLCompositeDirectCollectionMapping resp = new XMLCompositeDirectCollectionMapping();
resp.setAttributeName("responsibilities");
resp.setGetMethodName("getResponsibilities");
resp.setSetMethodName("setResponsibilities");
resp.setXPath("responsibilities/responsibility");
resp.getContainerPolicy().setContainerClass(Vector.class);
descriptor.addMapping(resp);
XMLCompositeCollectionMapping phone = new XMLCompositeCollectionMapping();
phone.setAttributeName("phoneNumbers");
phone.setGetMethodName("getPhoneNumbers");
phone.setSetMethodName("setPhoneNumbers");
phone.setXPath("phones/phone");
phone.setReferenceClass(PhoneNumber.class);
phone.getContainerPolicy().setContainerClass(Vector.class);
descriptor.addMapping(phone);
this.addDescriptor(descriptor);
}
use of org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping in project eclipselink by eclipse-ee4j.
the class MyProject method getIntermediateValueDescriptor.
private XMLDescriptor getIntermediateValueDescriptor() {
XMLDescriptor xmlDescriptor = new XMLDescriptor();
xmlDescriptor.setJavaClass(IntermediateValue.class);
XMLDirectMapping partAMapping = new XMLDirectMapping();
partAMapping.setAttributeName("partA");
partAMapping.setXPath("valuePartA/text()");
xmlDescriptor.addMapping(partAMapping);
XMLCompositeDirectCollectionMapping partBMapping = new XMLCompositeDirectCollectionMapping();
partBMapping.setAttributeName("partB");
partBMapping.setXPath("valuePartB/text()");
xmlDescriptor.addMapping(partBMapping);
return xmlDescriptor;
}
use of org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping in project eclipselink by eclipse-ee4j.
the class XMLSessionConfigProject method buildSessionBrokerConfigDescriptor.
public ClassDescriptor buildSessionBrokerConfigDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(SessionBrokerConfig.class);
descriptor.getInheritancePolicy().setParentClass(SessionConfig.class);
XMLCompositeDirectCollectionMapping sessionNamesMapping = new XMLCompositeDirectCollectionMapping();
sessionNamesMapping.setAttributeName("m_sessionNames");
sessionNamesMapping.setGetMethodName("getSessionNames");
sessionNamesMapping.setSetMethodName("setSessionNames");
sessionNamesMapping.setXPath("session-name/text()");
descriptor.addMapping(sessionNamesMapping);
return descriptor;
}
Aggregations