EclipseLink 2.0.0, build 'v20091127-r5931' API Reference

org.eclipse.persistence.oxm.record
Class MarshalRecord

java.lang.Object
  extended by org.eclipse.persistence.internal.sessions.AbstractRecord
      extended by org.eclipse.persistence.oxm.record.XMLRecord
          extended by org.eclipse.persistence.oxm.record.MarshalRecord
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map, Record
Direct Known Subclasses:
ContentHandlerRecord, NodeRecord, OutputStreamRecord, WriterRecord, XMLEventWriterRecord, XMLStreamWriterRecord

public abstract class MarshalRecord
extends XMLRecord

A MarshalRecord encapsulates the marshal target.

MarshalRecords are stateful and state changes are triggered by different event notifications, therefore this class is not thread safe.

XML document creation will differ depending on the subclass of MarshalRecord used. For example when NodeRecord is used a child element is created on the openStartElement event, and when the ContentHandlerRecord is used a child element is not created until the closeStartMethod event.

See Also:
XMLMarshaller, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.persistence.internal.sessions.AbstractRecord
org.eclipse.persistence.internal.sessions.AbstractRecord.EntrySet, org.eclipse.persistence.internal.sessions.AbstractRecord.KeySet, org.eclipse.persistence.internal.sessions.AbstractRecord.NoEntry, org.eclipse.persistence.internal.sessions.AbstractRecord.RecordEntry, org.eclipse.persistence.internal.sessions.AbstractRecord.RecordEntryIterator, org.eclipse.persistence.internal.sessions.AbstractRecord.RecordKeyIterator, org.eclipse.persistence.internal.sessions.AbstractRecord.RecordValuesIterator, org.eclipse.persistence.internal.sessions.AbstractRecord.ValuesSet
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
 
Fields inherited from class org.eclipse.persistence.oxm.record.XMLRecord
currentObject, NIL, session, unmarshaller
 
Fields inherited from class org.eclipse.persistence.internal.sessions.AbstractRecord
fields, lookupField, noEntry, size, values
 
Constructor Summary
MarshalRecord()
           
 
Method Summary
 void add(org.eclipse.persistence.internal.helper.DatabaseField key, java.lang.Object value)
          INTERNAL: Add the field-value pair to the document.
 void addGroupingElement(org.eclipse.persistence.internal.oxm.XPathNode xPathNode)
          INTERNAL: If an XPathNode does not have an associated NodeValue then add it to the MarshalRecord as a grouping element.
protected  void addPositionalNodes(org.eclipse.persistence.internal.oxm.XPathFragment xPathFragment, NamespaceResolver namespaceResolver)
           
abstract  void attribute(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, java.lang.String value)
          Receive notification of an attribute.
abstract  void attribute(org.eclipse.persistence.internal.oxm.XPathFragment xPathFragment, NamespaceResolver namespaceResolver, java.lang.String value)
          Receive notification of an attribute.
abstract  void cdata(java.lang.String value)
          Receive notification of character data to be wrapped in a CDATA node.
abstract  void characters(java.lang.String value)
          Receive notification of character data.
 void clear()
          PUBLIC: Clear the sub-nodes of the DOM.
abstract  void closeStartElement()
          Receive notification that all of the attribute events have occurred for the most recent element that has been started.
 void closeStartGroupingElements(org.eclipse.persistence.internal.oxm.XPathFragment groupingFragment)
           
abstract  void element(org.eclipse.persistence.internal.oxm.XPathFragment frag)
          Receive notification of an element.
abstract  void endDocument()
          Recieve notification that a document is being ended.
abstract  void endElement(org.eclipse.persistence.internal.oxm.XPathFragment xPathFragment, NamespaceResolver namespaceResolver)
          Receive notification that an element is being ended.
 void endPrefixMapping(java.lang.String prefix)
          Receive notification that the scope of this namespace declaration has ended.
 void endPrefixMappings(NamespaceResolver namespaceResolver)
           
 org.w3c.dom.Document getDocument()
          PUBLIC: Return the document.
 org.w3c.dom.Element getDOM()
          PUBLIC: Return the DOM.
 java.lang.String getLocalName()
          PUBLIC: Get the local name of the context root element.
 java.lang.String getNamespaceURI()
          PUBLIC: Get the namespace URI for the context root element.
 java.util.HashMap getPositionalNodes()
           
 void namespaceDeclarations(NamespaceResolver namespaceResolver)
          INTERNAL: Add the namespace declarations to the XML document.
abstract  void node(org.w3c.dom.Node node, NamespaceResolver resolver)
          Receive notification of a node.
 void openStartElement(org.eclipse.persistence.internal.oxm.XPathFragment xPathFragment, NamespaceResolver namespaceResolver)
          Receive notification that an element is being started.
 org.eclipse.persistence.internal.oxm.XPathFragment openStartGroupingElements(NamespaceResolver namespaceResolver)
          INTERNAL: Trigger that the grouping elements should be written.
 java.lang.Object put(org.eclipse.persistence.internal.helper.DatabaseField key, java.lang.Object value)
          INTERNAL: Add the field-value pair to the document.
 void removeGroupingElement(org.eclipse.persistence.internal.oxm.XPathNode xPathNode)
          INTERNAL:
abstract  void startDocument(java.lang.String encoding, java.lang.String version)
          Receive notification that a document is being started.
 void startPrefixMapping(java.lang.String prefix, java.lang.String namespaceURI)
          Receive notification that a namespace has been declared.
 void startPrefixMappings(NamespaceResolver namespaceResolver)
           
 java.lang.String transformToXML()
          Return the XML string representation of the DOM.
 
Methods inherited from class org.eclipse.persistence.oxm.record.XMLRecord
contains, convertToXMLField, convertToXMLField, get, getCurrentObject, getDocPresPolicy, getIndicatingNoEntry, getLeafElementType, getMarshaller, getNamespaceResolver, getOwningObject, getSession, getUnmarshaller, isXOPPackage, resolveNamespacePrefix, setCurrentObject, setDocPresPolicy, setLeafElementType, setMarshaller, setNamespaceResolver, setOwningObject, setSession, setUnmarshaller, setXOPPackage
 
Methods inherited from class org.eclipse.persistence.internal.sessions.AbstractRecord
clone, containsKey, containsKey, containsKey, containsValue, elements, entrySet, get, get, getField, getFields, getIndicatingNoEntry, getValues, getValues, getValues, isEmpty, keys, keySet, mergeFrom, put, put, putAll, remove, remove, remove, replaceAt, resetSize, setFields, setValues, size, toString, values
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

MarshalRecord

public MarshalRecord()
Method Detail

getPositionalNodes

public java.util.HashMap getPositionalNodes()

getLocalName

public java.lang.String getLocalName()
Description copied from class: XMLRecord
PUBLIC: Get the local name of the context root element.

Specified by:
getLocalName in class XMLRecord

getNamespaceURI

public java.lang.String getNamespaceURI()
Description copied from class: XMLRecord
PUBLIC: Get the namespace URI for the context root element.

Specified by:
getNamespaceURI in class XMLRecord

clear

public void clear()
Description copied from class: XMLRecord
PUBLIC: Clear the sub-nodes of the DOM.

Specified by:
clear in interface java.util.Map
Specified by:
clear in class XMLRecord

getDocument

public org.w3c.dom.Document getDocument()
Description copied from class: XMLRecord
PUBLIC: Return the document.

Specified by:
getDocument in class XMLRecord

getDOM

public org.w3c.dom.Element getDOM()
Description copied from class: XMLRecord
PUBLIC: Return the DOM.

Specified by:
getDOM in class XMLRecord

addGroupingElement

public void addGroupingElement(org.eclipse.persistence.internal.oxm.XPathNode xPathNode)
INTERNAL: If an XPathNode does not have an associated NodeValue then add it to the MarshalRecord as a grouping element.

Parameters:
xPathNode -

removeGroupingElement

public void removeGroupingElement(org.eclipse.persistence.internal.oxm.XPathNode xPathNode)
INTERNAL:

Parameters:
xPathNode -

transformToXML

public java.lang.String transformToXML()
Description copied from class: XMLRecord
Return the XML string representation of the DOM.

Specified by:
transformToXML in class XMLRecord

add

public void add(org.eclipse.persistence.internal.helper.DatabaseField key,
                java.lang.Object value)
INTERNAL: Add the field-value pair to the document.

Overrides:
add in class org.eclipse.persistence.internal.sessions.AbstractRecord

put

public java.lang.Object put(org.eclipse.persistence.internal.helper.DatabaseField key,
                            java.lang.Object value)
INTERNAL: Add the field-value pair to the document.

Overrides:
put in class org.eclipse.persistence.internal.sessions.AbstractRecord

namespaceDeclarations

public void namespaceDeclarations(NamespaceResolver namespaceResolver)
INTERNAL: Add the namespace declarations to the XML document.

Parameters:
namespaceResolver - The NamespaceResolver contains the namespace prefix and URI pairings that need to be declared.

startDocument

public abstract void startDocument(java.lang.String encoding,
                                   java.lang.String version)
Receive notification that a document is being started.

Parameters:
encoding - The XML document will be encoded using this encoding.
version - This specifies the version of XML.

endDocument

public abstract void endDocument()
Recieve notification that a document is being ended.


startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String namespaceURI)
Receive notification that a namespace has been declared.

Parameters:
prefix - The namespace prefix.
namespaceURI - The namespace URI.

startPrefixMappings

public void startPrefixMappings(NamespaceResolver namespaceResolver)

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
Receive notification that the scope of this namespace declaration has ended.

Parameters:
prefix - The namespace prefix.

endPrefixMappings

public void endPrefixMappings(NamespaceResolver namespaceResolver)

openStartElement

public void openStartElement(org.eclipse.persistence.internal.oxm.XPathFragment xPathFragment,
                             NamespaceResolver namespaceResolver)
Receive notification that an element is being started.

Parameters:
xPathFragment - The XPathFragment contains the name and prefix information about the XML element being ended.
namespaceResolver - The NamespaceResolver can be used to resolve the namespace URI for the namespace prefix held by the XPathFragment (if required).

element

public abstract void element(org.eclipse.persistence.internal.oxm.XPathFragment frag)
Receive notification of an element.

Parameters:
frag - The XPathFragment of the element

attribute

public abstract void attribute(org.eclipse.persistence.internal.oxm.XPathFragment xPathFragment,
                               NamespaceResolver namespaceResolver,
                               java.lang.String value)
Receive notification of an attribute.

Parameters:
xPathFragment - The XPathFragment contains the name and prefix information about the XML element being ended.
namespaceResolver - The NamespaceResolver can be used to resolve the namespace URI for the namespace prefix held by the XPathFragment (if required).
value - This is the complete value for the attribute.

attribute

public abstract void attribute(java.lang.String namespaceURI,
                               java.lang.String localName,
                               java.lang.String qName,
                               java.lang.String value)
Receive notification of an attribute.

Parameters:
namespaceURI - The namespace URI, if the attribute is not namespace qualified the value of this parameter wil be null.
localName - The local name of the attribute.
qName - The qualified name of the attribute.
value - This is the complete value for the attribute.

closeStartElement

public abstract void closeStartElement()
Receive notification that all of the attribute events have occurred for the most recent element that has been started.


endElement

public abstract void endElement(org.eclipse.persistence.internal.oxm.XPathFragment xPathFragment,
                                NamespaceResolver namespaceResolver)
Receive notification that an element is being ended.

Parameters:
xPathFragment - The XPathFragment contains the name and prefix information about the XML element being ended.
namespaceResolver - The NamespaceResolver can be used to resolve the namespace URI for the namespace prefix held by the XPathFragment (if required).

characters

public abstract void characters(java.lang.String value)
Receive notification of character data.

Parameters:
value - This is the entire value of the text node.

cdata

public abstract void cdata(java.lang.String value)
Receive notification of character data to be wrapped in a CDATA node.

Parameters:
value - This is the value of the text to be wrapped

node

public abstract void node(org.w3c.dom.Node node,
                          NamespaceResolver resolver)
Receive notification of a node.

Parameters:
node - The Node to be added to the document
namespaceResolver - The NamespaceResolver can be used to resolve the namespace URI/prefix of the node

openStartGroupingElements

public org.eclipse.persistence.internal.oxm.XPathFragment openStartGroupingElements(NamespaceResolver namespaceResolver)
INTERNAL: Trigger that the grouping elements should be written. This is normally done when something like a mapping has a non-null value that is marshalled.

Parameters:
namespaceResolver - The NamespaceResolver can be used to resolve the namespace URI for the namespace prefix held by the XPathFragment (if required).

closeStartGroupingElements

public void closeStartGroupingElements(org.eclipse.persistence.internal.oxm.XPathFragment groupingFragment)

addPositionalNodes

protected void addPositionalNodes(org.eclipse.persistence.internal.oxm.XPathFragment xPathFragment,
                                  NamespaceResolver namespaceResolver)

EclipseLink 2.0.0, build 'v20091127-r5931' API Reference