Class XMLObjectReferenceMappingNodeValue
- java.lang.Object
-
- org.eclipse.persistence.internal.oxm.NodeValue
-
- org.eclipse.persistence.internal.oxm.MappingNodeValue
-
- org.eclipse.persistence.internal.oxm.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 Summary
Constructors Constructor Description XMLObjectReferenceMappingNodeValue(ObjectReferenceMapping xmlObjectReferenceMapping)
This constructor sets the XMLObjectReferenceMapping member to the provided value.XMLObjectReferenceMappingNodeValue(ObjectReferenceMapping xmlObjectReferenceMapping, Field xmlField)
This constructor sets the XMLObjectReferenceMapping and XMLField members to the provided values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
attribute(UnmarshalRecord unmarshalRecord, String namespaceURI, String localName, String value)
Handle attribute operation.void
endElement(XPathFragment xPathFragment, UnmarshalRecord unmarshalRecord)
Handle endElement operation.ObjectReferenceMapping
getMapping()
Return the mapping associated with this node value.boolean
isOwningNode(XPathFragment xPathFragment)
Indicate if the XPathFragment is an attribute or text() node.boolean
marshal(XPathFragment xPathFragment, MarshalRecord marshalRecord, Object object, CoreAbstractSession session, NamespaceResolver namespaceResolver)
Handle the marshal operation for this NodeValue's XMLField.boolean
marshal(XPathFragment xPathFragment, MarshalRecord marshalRecord, Object object, CoreAbstractSession session, NamespaceResolver namespaceResolver, MarshalContext marshalContext)
Handle the marshal operation for this NodeValue's XMLField.boolean
marshalSingleValue(XPathFragment xPathFragment, MarshalRecord marshalRecord, Object object, Object targetObject, CoreAbstractSession session, NamespaceResolver namespaceResolver, MarshalContext marshalContext)
INTERNAL: This method provides an optimization in cases where the value has already been calculated.-
Methods inherited from class org.eclipse.persistence.internal.oxm.MappingNodeValue
addTypeAttribute, isMappingNodeValue, updateNamespaces
-
Methods inherited from class org.eclipse.persistence.internal.oxm.NodeValue
buildSelfRecord, endElement, endSelfNodeValue, getXPathNode, isAnyMappingNodeValue, isContainerValue, isMarshalNodeValue, isMarshalOnlyNodeValue, isMixedContentNodeValue, isNullCapableValue, isUnmarshalNodeValue, isWhitespaceAware, isWrapperNodeValue, marshal, marshal, marshalSelfAttributes, marshalSingleValue, setXPathNode, startElement
-
-
-
-
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.
-
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 classNodeValue
-
isOwningNode
public boolean isOwningNode(XPathFragment xPathFragment)
Indicate if the XPathFragment is an attribute or text() node.- Overrides:
isOwningNode
in classNodeValue
- 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.
-
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.
-
marshalSingleValue
public boolean marshalSingleValue(XPathFragment xPathFragment, MarshalRecord marshalRecord, Object object, Object targetObject, CoreAbstractSession session, NamespaceResolver namespaceResolver, MarshalContext marshalContext)
Description copied from class:NodeValue
INTERNAL: This method provides an optimization in cases where the value has already been calculated.- Specified by:
marshalSingleValue
in classNodeValue
- Returns:
-
getMapping
public ObjectReferenceMapping getMapping()
Description copied from class:MappingNodeValue
Return the mapping associated with this node value.- Specified by:
getMapping
in classMappingNodeValue
-
-