Search in sources :

Example 36 with XMLCompositeDirectCollectionMapping

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;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) XMLCompositeCollectionMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping) XMLCompositeDirectCollectionMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping) XMLCompositeObjectMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeObjectMapping)

Example 37 with XMLCompositeDirectCollectionMapping

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);
}
Also used : XMLCompositeDirectCollectionMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping)

Example 38 with XMLCompositeDirectCollectionMapping

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);
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) XMLCompositeCollectionMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping) XMLCompositeDirectCollectionMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping) XMLCompositeObjectMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeObjectMapping)

Example 39 with XMLCompositeDirectCollectionMapping

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;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) XMLCompositeDirectCollectionMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping)

Example 40 with XMLCompositeDirectCollectionMapping

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;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLCompositeDirectCollectionMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping)

Aggregations

XMLCompositeDirectCollectionMapping (org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping)63 XMLDescriptor (org.eclipse.persistence.oxm.XMLDescriptor)49 XMLDirectMapping (org.eclipse.persistence.oxm.mappings.XMLDirectMapping)40 XMLField (org.eclipse.persistence.oxm.XMLField)14 XMLCompositeCollectionMapping (org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping)11 XMLCompositeObjectMapping (org.eclipse.persistence.oxm.mappings.XMLCompositeObjectMapping)11 NamespaceResolver (org.eclipse.persistence.oxm.NamespaceResolver)10 QName (javax.xml.namespace.QName)6 DatabaseMapping (org.eclipse.persistence.mappings.DatabaseMapping)6 ClassDescriptor (org.eclipse.persistence.descriptors.ClassDescriptor)3 DescriptorException (org.eclipse.persistence.exceptions.DescriptorException)3 JAXBException (org.eclipse.persistence.exceptions.JAXBException)3 DatabaseField (org.eclipse.persistence.internal.helper.DatabaseField)3 JAXBArrayAttributeAccessor (org.eclipse.persistence.internal.jaxb.many.JAXBArrayAttributeAccessor)3 Field (org.eclipse.persistence.internal.oxm.mappings.Field)3 JavaClass (org.eclipse.persistence.jaxb.javamodel.JavaClass)3 BigDecimal (java.math.BigDecimal)2 CoreDescriptor (org.eclipse.persistence.core.descriptors.CoreDescriptor)2 CoreMapping (org.eclipse.persistence.core.mappings.CoreMapping)2 CoreConverter (org.eclipse.persistence.core.mappings.converters.CoreConverter)2