Search in sources :

Example 11 with XMLDirectMapping

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

the class XMLEntityMappingsMappingProject method buildAccessMethodsDescriptor.

/**
 * INTERNAL:
 * XSD: access-methods
 */
protected ClassDescriptor buildAccessMethodsDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(AccessMethodsMetadata.class);
    XMLDirectMapping getMethodMapping = new XMLDirectMapping();
    getMethodMapping.setAttributeName("m_getMethodName");
    getMethodMapping.setGetMethodName("getGetMethodName");
    getMethodMapping.setSetMethodName("setGetMethodName");
    getMethodMapping.setXPath("@get-method");
    descriptor.addMapping(getMethodMapping);
    XMLDirectMapping setMethodMapping = new XMLDirectMapping();
    setMethodMapping.setAttributeName("m_setMethodName");
    setMethodMapping.setGetMethodName("getSetMethodName");
    setMethodMapping.setSetMethodName("setSetMethodName");
    setMethodMapping.setXPath("@set-method");
    descriptor.addMapping(setMethodMapping);
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping)

Example 12 with XMLDirectMapping

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

the class XMLEntityMappingsMappingProject method getClassTypeAttributeMapping.

/**
 * INTERNAL:
 */
protected XMLDirectMapping getClassTypeAttributeMapping() {
    XMLDirectMapping mapping = new XMLDirectMapping();
    mapping.setAttributeName("m_typeName");
    mapping.setGetMethodName("getTypeName");
    mapping.setSetMethodName("setTypeName");
    mapping.setXPath("@class");
    return mapping;
}
Also used : XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping)

Example 13 with XMLDirectMapping

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

the class XMLEntityMappingsMappingProject method getQueryParameterAttributeMapping.

/**
 * INTERNAL:
 */
protected XMLDirectMapping getQueryParameterAttributeMapping() {
    XMLDirectMapping queryParameterMapping = new XMLDirectMapping();
    queryParameterMapping.setAttributeName("m_queryParameter");
    queryParameterMapping.setGetMethodName("getQueryParameter");
    queryParameterMapping.setSetMethodName("setQueryParameter");
    queryParameterMapping.setXPath("@query-parameter");
    return queryParameterMapping;
}
Also used : XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping)

Example 14 with XMLDirectMapping

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

the class XMLEntityMappingsMappingProject method getLengthAttributeMapping.

/**
 * INTERNAL:
 */
protected XMLDirectMapping getLengthAttributeMapping() {
    XMLDirectMapping lengthMapping = new XMLDirectMapping();
    lengthMapping.setAttributeName("m_length");
    lengthMapping.setGetMethodName("getLength");
    lengthMapping.setSetMethodName("setLength");
    lengthMapping.setXPath("@length");
    return lengthMapping;
}
Also used : XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping)

Example 15 with XMLDirectMapping

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

the class MappingsGenerator method generateDirectEnumerationMapping.

public DirectMapping generateDirectEnumerationMapping(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo, EnumTypeInfo enumInfo) {
    DirectMapping mapping = new XMLDirectMapping();
    initializeXMLMapping((XMLMapping) mapping, property);
    mapping.setNullValueMarshalled(true);
    mapping.setConverter(buildJAXBEnumTypeConverter(mapping, enumInfo));
    // handle null policy set via xml metadata
    if (property.isSetNullPolicy()) {
        mapping.setNullPolicy(getNullPolicyFromProperty(property, getNamespaceResolverForDescriptor(namespaceInfo)));
    } else if (property.isNillable()) {
        mapping.getNullPolicy().setNullRepresentedByXsiNil(true);
        mapping.getNullPolicy().setMarshalNullRepresentation(XMLNullRepresentationType.XSI_NIL);
    }
    mapping.setField(getXPathForField(property, namespaceInfo, true, false));
    if (!mapping.getXPath().equals("text()")) {
        ((NullPolicy) mapping.getNullPolicy()).setSetPerformedForAbsentNode(false);
    }
    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) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) DirectMapping(org.eclipse.persistence.internal.oxm.mappings.DirectMapping)

Aggregations

XMLDirectMapping (org.eclipse.persistence.oxm.mappings.XMLDirectMapping)802 XMLDescriptor (org.eclipse.persistence.oxm.XMLDescriptor)630 XMLCompositeObjectMapping (org.eclipse.persistence.oxm.mappings.XMLCompositeObjectMapping)103 XMLField (org.eclipse.persistence.oxm.XMLField)100 XMLCompositeCollectionMapping (org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping)78 NamespaceResolver (org.eclipse.persistence.oxm.NamespaceResolver)74 XMLSchemaClassPathReference (org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference)53 XMLCompositeDirectCollectionMapping (org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping)41 ClassDescriptor (org.eclipse.persistence.descriptors.ClassDescriptor)35 QName (javax.xml.namespace.QName)33 ObjectTypeConverter (org.eclipse.persistence.mappings.converters.ObjectTypeConverter)28 XMLSchemaURLReference (org.eclipse.persistence.oxm.schema.XMLSchemaURLReference)26 AttributeAccessor (org.eclipse.persistence.mappings.AttributeAccessor)25 ArrayList (java.util.ArrayList)24 XMLObjectReferenceMapping (org.eclipse.persistence.oxm.mappings.XMLObjectReferenceMapping)22 URL (java.net.URL)21 XMLCollectionReferenceMapping (org.eclipse.persistence.oxm.mappings.XMLCollectionReferenceMapping)21 List (java.util.List)15 DatabaseField (org.eclipse.persistence.internal.helper.DatabaseField)14 IsSetNullPolicy (org.eclipse.persistence.oxm.mappings.nullpolicy.IsSetNullPolicy)14