com.openharbor.beck.map
Interface MapToXML

All Known Implementing Classes:
DefaultMapper

public interface MapToXML

Maps from Java to XML.


Nested Class Summary
static interface MapToXML.Source
          A source of MapToXML objects.
 
Method Summary
 Identifier getIdentifier(java.lang.Object parent, Getter getter)
          Choose the XML representation of repeated references to an object.
 Marshaller getMarshaller(java.lang.Object parent, XMLThing parentElement, Getter getter)
          Choose the Marshaller object for a given source Java object.
 Prefixer getPrefixer()
          Choose a mapping from namespace URI to preferred XML prefix.
 Getter[] getProperties(java.lang.Object parent, Getter getter, java.lang.Object source)
          Find the properties of a given Java object that can be mapped to XML.
 java.lang.String getText(java.lang.Object parent, Marshaller marshaller, XMLWriter writer)
          Choose the Java property to be copied to XML text.
 XMLThing getXML(java.lang.Object parent, Getter getter, Marshaller marshaller, XMLWriter writer)
          Choose the XML element or attribute name for a Java object.
 

Method Detail

getPrefixer

public Prefixer getPrefixer()
Choose a mapping from namespace URI to preferred XML prefix.

Returns:
the configured Prefixer, or null if none is configured.

getMarshaller

public Marshaller getMarshaller(java.lang.Object parent,
                                XMLThing parentElement,
                                Getter getter)
Choose the Marshaller object for a given source Java object.

Parameters:
getter - to be mapped to XML
parent - contains source. null if source is the root object.
Returns:
a Marshaller configured for this case, or a default if none is configured.

getXML

public XMLThing getXML(java.lang.Object parent,
                       Getter getter,
                       Marshaller marshaller,
                       XMLWriter writer)
                throws java.lang.Exception
Choose the XML element or attribute name for a Java object. If the returned thing is an element with a null value, the caller should output the element and also additional attributes and/or content mapped from the source object. If the returned thing is an attribute or an element with a non-null value, the caller should output the returned thing without additions.

Parameters:
getter - to be mapped to XML
parent - contains source
Returns:
an attribute name and value or an element name with a set of conditions, or null to indicate that this source should not be marshalled.
Throws:
java.lang.Exception

getText

public java.lang.String getText(java.lang.Object parent,
                                Marshaller marshaller,
                                XMLWriter writer)
Choose the Java property to be copied to XML text.

Returns:
the property name, or null to indicate no such property is configured.

getIdentifier

public Identifier getIdentifier(java.lang.Object parent,
                                Getter getter)
Choose the XML representation of repeated references to an object.

Parameters:
getter - to be mapped to XML
parent - contains source. null if source is the root object.
Returns:
the chosen Identifier, or null to map repeated references to copies of the XML.

getProperties

public Getter[] getProperties(java.lang.Object parent,
                              Getter getter,
                              java.lang.Object source)
Find the properties of a given Java object that can be mapped to XML.

Parameters:
source - to be mapped to XML
parent - contains source. null if source is the root object.
Returns:
a Getter for each property of the given source object.