Search in sources :

Example 26 with XMLDirectMapping

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

the class EclipseLinkObjectPersistenceRuntimeXMLProject method buildXMLFieldDescriptor.

@Override
protected ClassDescriptor buildXMLFieldDescriptor() {
    XMLDescriptor descriptor = (XMLDescriptor) super.buildXMLFieldDescriptor();
    XMLDirectMapping isRequiredMapping = new XMLDirectMapping();
    isRequiredMapping.setAttributeName("isRequired");
    isRequiredMapping.setGetMethodName("isRequired");
    isRequiredMapping.setSetMethodName("setRequired");
    isRequiredMapping.setXPath(getPrimaryNamespaceXPath() + "@is-required");
    isRequiredMapping.setNullValue(Boolean.FALSE);
    descriptor.addMapping(isRequiredMapping);
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping)

Example 27 with XMLDirectMapping

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

the class EclipseLinkObjectPersistenceRuntimeXMLProject method buildXMLChoiceCollectionMappingDescriptor.

@Override
protected ClassDescriptor buildXMLChoiceCollectionMappingDescriptor() {
    XMLDescriptor descriptor = (XMLDescriptor) super.buildXMLChoiceCollectionMappingDescriptor();
    XMLDirectMapping reuseContainerMapping = new XMLDirectMapping();
    reuseContainerMapping.setAttributeName("reuseContainer");
    reuseContainerMapping.setGetMethodName("getReuseContainer");
    reuseContainerMapping.setSetMethodName("setReuseContainer");
    reuseContainerMapping.setXPath(getPrimaryNamespaceXPath() + "reuse-container/text()");
    reuseContainerMapping.setNullValue(Boolean.FALSE);
    descriptor.addMapping(reuseContainerMapping);
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping)

Example 28 with XMLDirectMapping

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

the class EclipseLinkObjectPersistenceRuntimeXMLProject method buildXMLCompositeObjectMappingDescriptor.

@Override
protected ClassDescriptor buildXMLCompositeObjectMappingDescriptor() {
    ClassDescriptor descriptor = super.buildXMLCompositeObjectMappingDescriptor();
    // Add container accessor mapping
    XMLDirectMapping containerAttributeMapping = new XMLDirectMapping();
    containerAttributeMapping.setAttributeName("containerAttributeName");
    containerAttributeMapping.setGetMethodName("getContainerAttributeName");
    containerAttributeMapping.setSetMethodName("setContainerAttributeName");
    containerAttributeMapping.setXPath("container-attribute/text()");
    ((NullPolicy) containerAttributeMapping.getNullPolicy()).setSetPerformedForAbsentNode(false);
    descriptor.addMapping(containerAttributeMapping);
    XMLDirectMapping containerGetMethodMapping = new XMLDirectMapping();
    containerGetMethodMapping.setAttributeName("containerGetMethodName");
    containerGetMethodMapping.setGetMethodName("getContainerGetMethodName");
    containerGetMethodMapping.setSetMethodName("setContainerGetMethodName");
    containerGetMethodMapping.setXPath("container-get-method/text()");
    ((NullPolicy) containerGetMethodMapping.getNullPolicy()).setSetPerformedForAbsentNode(false);
    descriptor.addMapping(containerGetMethodMapping);
    XMLDirectMapping containerSetMethodMapping = new XMLDirectMapping();
    containerSetMethodMapping.setAttributeName("containerSetMethodName");
    containerSetMethodMapping.setGetMethodName("getContainerSetMethodName");
    containerSetMethodMapping.setSetMethodName("setContainerSetMethodName");
    containerSetMethodMapping.setXPath("container-set-method/text()");
    ((NullPolicy) containerSetMethodMapping.getNullPolicy()).setSetPerformedForAbsentNode(false);
    descriptor.addMapping(containerSetMethodMapping);
    XMLDirectMapping keepAsElementMapping = new XMLDirectMapping();
    keepAsElementMapping.setAttributeName("keepAsElementPolicy");
    keepAsElementMapping.setGetMethodName("getKeepAsElementPolicy");
    keepAsElementMapping.setSetMethodName("setKeepAsElementPolicy");
    keepAsElementMapping.setXPath(getPrimaryNamespaceXPath() + "keep-as-element-policy");
    EnumTypeConverter converter = new EnumTypeConverter(keepAsElementMapping, UnmarshalKeepAsElementPolicy.class, false);
    keepAsElementMapping.setConverter(converter);
    descriptor.addMapping(keepAsElementMapping);
    return descriptor;
}
Also used : AbstractNullPolicy(org.eclipse.persistence.oxm.mappings.nullpolicy.AbstractNullPolicy) NullPolicy(org.eclipse.persistence.oxm.mappings.nullpolicy.NullPolicy) ClassDescriptor(org.eclipse.persistence.descriptors.ClassDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) EnumTypeConverter(org.eclipse.persistence.mappings.converters.EnumTypeConverter)

Example 29 with XMLDirectMapping

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

the class EclipseLinkObjectPersistenceRuntimeXMLProject method buildXMLListConverterDescriptor.

protected ClassDescriptor buildXMLListConverterDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(XMLListConverter.class);
    descriptor.getInheritancePolicy().setParentClass(Converter.class);
    XMLDirectMapping fieldSubElementClassNameMapping = new XMLDirectMapping();
    fieldSubElementClassNameMapping.setAttributeName("objectClassName");
    fieldSubElementClassNameMapping.setGetMethodName("getObjectClassName");
    fieldSubElementClassNameMapping.setSetMethodName("setObjectClassName");
    fieldSubElementClassNameMapping.setXPath(getPrimaryNamespaceXPath() + "object-class-name");
    descriptor.addMapping(fieldSubElementClassNameMapping);
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping)

Example 30 with XMLDirectMapping

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

the class EclipseLinkObjectPersistenceRuntimeXMLProject method buildXMLAnyAttributeMappingDescriptor.

@Override
protected ClassDescriptor buildXMLAnyAttributeMappingDescriptor() {
    ClassDescriptor descriptor = super.buildXMLAnyAttributeMappingDescriptor();
    XMLDirectMapping includeNamespaceDeclarationMapping = new XMLDirectMapping();
    includeNamespaceDeclarationMapping.setAttributeName("isNamespaceDeclarationIncluded");
    includeNamespaceDeclarationMapping.setGetMethodName("isNamespaceDeclarationIncluded");
    includeNamespaceDeclarationMapping.setSetMethodName("setNamespaceDeclarationIncluded");
    includeNamespaceDeclarationMapping.setXPath(getPrimaryNamespaceXPath() + "include-namespace-declaration/text()");
    descriptor.addMapping(includeNamespaceDeclarationMapping);
    XMLDirectMapping includeSchemaInstanceMapping = new XMLDirectMapping();
    includeSchemaInstanceMapping.setAttributeName("isSchemaInstanceIncluded");
    includeSchemaInstanceMapping.setGetMethodName("isSchemaInstanceIncluded");
    includeSchemaInstanceMapping.setSetMethodName("setSchemaInstanceIncluded");
    includeSchemaInstanceMapping.setXPath(getPrimaryNamespaceXPath() + "include-schema-instance/text()");
    descriptor.addMapping(includeSchemaInstanceMapping);
    XMLDirectMapping reuseContainerMapping = new XMLDirectMapping();
    reuseContainerMapping.setAttributeName("reuseContainer");
    reuseContainerMapping.setGetMethodName("getReuseContainer");
    reuseContainerMapping.setSetMethodName("setReuseContainer");
    reuseContainerMapping.setXPath(getPrimaryNamespaceXPath() + "reuse-container/text()");
    reuseContainerMapping.setNullValue(Boolean.FALSE);
    descriptor.addMapping(reuseContainerMapping);
    return descriptor;
}
Also used : ClassDescriptor(org.eclipse.persistence.descriptors.ClassDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping)

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