Search in sources :

Example 1 with XMLVariableXPathObjectMapping

use of org.eclipse.persistence.oxm.mappings.XMLVariableXPathObjectMapping in project eclipselink by eclipse-ee4j.

the class MappingsGenerator method generateVariableXPathObjectMapping.

private Mapping generateVariableXPathObjectMapping(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo, JavaClass actualType) {
    XMLVariableXPathObjectMapping mapping = new XMLVariableXPathObjectMapping();
    initializeXMLMapping(mapping, property);
    initializeVariableXPathMapping(mapping, property, actualType);
    // handle null policy set via xml metadata
    if (property.isSetNullPolicy()) {
        mapping.setNullPolicy(getNullPolicyFromProperty(property, getNamespaceResolverForDescriptor(namespaceInfo)));
    } else {
        NullPolicy nullPolicy = (NullPolicy) mapping.getNullPolicy();
        nullPolicy.setSetPerformedForAbsentNode(false);
        if (property.isNillable()) {
            nullPolicy.setNullRepresentedByXsiNil(true);
            nullPolicy.setMarshalNullRepresentation(XMLNullRepresentationType.XSI_NIL);
        }
    }
    if (property.getXmlPath() != null) {
        mapping.setField(new XMLField(property.getXmlPath()));
    } else {
        if (property.isSetXmlElementWrapper()) {
            mapping.setField((XMLField) getXPathForField(property, namespaceInfo, false, true));
        }
    }
    return mapping;
}
Also used : IsSetNullPolicy(org.eclipse.persistence.oxm.mappings.nullpolicy.IsSetNullPolicy) XmlIsSetNullPolicy(org.eclipse.persistence.jaxb.xmlmodel.XmlIsSetNullPolicy) NullPolicy(org.eclipse.persistence.oxm.mappings.nullpolicy.NullPolicy) XmlNullPolicy(org.eclipse.persistence.jaxb.xmlmodel.XmlNullPolicy) XmlAbstractNullPolicy(org.eclipse.persistence.jaxb.xmlmodel.XmlAbstractNullPolicy) AbstractNullPolicy(org.eclipse.persistence.oxm.mappings.nullpolicy.AbstractNullPolicy) XMLField(org.eclipse.persistence.oxm.XMLField) XMLVariableXPathObjectMapping(org.eclipse.persistence.oxm.mappings.XMLVariableXPathObjectMapping)

Aggregations

XmlAbstractNullPolicy (org.eclipse.persistence.jaxb.xmlmodel.XmlAbstractNullPolicy)1 XmlIsSetNullPolicy (org.eclipse.persistence.jaxb.xmlmodel.XmlIsSetNullPolicy)1 XmlNullPolicy (org.eclipse.persistence.jaxb.xmlmodel.XmlNullPolicy)1 XMLField (org.eclipse.persistence.oxm.XMLField)1 XMLVariableXPathObjectMapping (org.eclipse.persistence.oxm.mappings.XMLVariableXPathObjectMapping)1 AbstractNullPolicy (org.eclipse.persistence.oxm.mappings.nullpolicy.AbstractNullPolicy)1 IsSetNullPolicy (org.eclipse.persistence.oxm.mappings.nullpolicy.IsSetNullPolicy)1 NullPolicy (org.eclipse.persistence.oxm.mappings.nullpolicy.NullPolicy)1