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;
}
Aggregations