Class XMLObjectReferenceMappingNodeValue


  • public class XMLObjectReferenceMappingNodeValue
    extends MappingNodeValue
    INTERNAL:

    Purpose: Class to handle (un)marshal operations for XMLObjectReferenceMappings. An instance of this class is required for each XMLField set on the mapping, that is, for each source field in the source-target key field association list.

    When unmarshalling, an instance of org.eclipse.persistence.internal.oxm.Reference is created on a per mapping basis (keyed on source object instance) and sotred on the associated session's org.eclipse.persistence.internal.oxm.ReferenceResolver instance. Each target primary key value is stored in the Reference instance for use during mapping resolution phase after unmarshalling completes.

    When marshalling, the target object's primary key value that is mapped to this NodeValue's XMLField (in the XMLObjectReferenceMapping's source-target key field association list) is retrieved and written out.

    See Also:
    Reference, ReferenceResolver, XMLObjectReferenceMapping
    • Constructor Detail

      • XMLObjectReferenceMappingNodeValue

        public XMLObjectReferenceMappingNodeValue​(ObjectReferenceMapping xmlObjectReferenceMapping)
        This constructor sets the XMLObjectReferenceMapping member to the provided value.
        Parameters:
        xmlObjectReferenceMapping -
      • XMLObjectReferenceMappingNodeValue

        public XMLObjectReferenceMappingNodeValue​(ObjectReferenceMapping xmlObjectReferenceMapping,
                                                  Field xmlField)
        This constructor sets the XMLObjectReferenceMapping and XMLField members to the provided values.
        Parameters:
        xmlObjectReferenceMapping -
        xmlField -
    • Method Detail

      • attribute

        public void attribute​(UnmarshalRecord unmarshalRecord,
                              String namespaceURI,
                              String localName,
                              String value)
        Handle attribute operation. Here we will create and populate an org.eclipse.persistence.internal.oxm.Reference instance to be used during the mapping resolution stage. In particular, the primary key value for this element will be added to the Reference object's list of target primary key values. Note that if a reference already exists for the xmlObjectReferenceMapping's source object instance, we will simply add to the target pk value list. The Reference object will is stored on the ReferenceResolver associated with the UnmarshalRecord's session.
        Overrides:
        attribute in class NodeValue
      • endElement

        public void endElement​(XPathFragment xPathFragment,
                               UnmarshalRecord unmarshalRecord)
        Handle endElement operation. Here we will create and populate an org.eclipse.persistence.internal.oxm.Reference instance to be used during the mapping resolution stage. In particular, the primary key value for this element will be added to the Reference object's list of target primary key values. Note that if a reference already exists for the xmlObjectReferenceMapping's source object instance, we will simply add to the target pk value list. The Reference object will is stored on the ReferenceResolver associated with the UnmarshalRecord's session.
        Overrides:
        endElement in class NodeValue
      • isOwningNode

        public boolean isOwningNode​(XPathFragment xPathFragment)
        Indicate if the XPathFragment is an attribute or text() node.
        Overrides:
        isOwningNode in class NodeValue
        Returns:
      • marshal

        public boolean marshal​(XPathFragment xPathFragment,
                               MarshalRecord marshalRecord,
                               Object object,
                               CoreAbstractSession session,
                               NamespaceResolver namespaceResolver)
        Handle the marshal operation for this NodeValue's XMLField. The target object's primary key value that is mapped to this NodeValue's XMLField (in the XMLObjectReferenceMapping's source-target key field association list) is retrieved and written out.
        Specified by:
        marshal in class NodeValue
        Returns:
      • marshal

        public boolean marshal​(XPathFragment xPathFragment,
                               MarshalRecord marshalRecord,
                               Object object,
                               CoreAbstractSession session,
                               NamespaceResolver namespaceResolver,
                               MarshalContext marshalContext)
        Handle the marshal operation for this NodeValue's XMLField. The target object's primary key value that is mapped to this NodeValue's XMLField (in the XMLObjectReferenceMapping's source-target key field association list) is retrieved and written out.
        Overrides:
        marshal in class NodeValue
        Returns: