com.openharbor.beck.marshal
Class XPathReferentsMarshaller

java.lang.Object
  extended bycom.openharbor.beck.marshal.DefaultMarshaller
      extended bycom.openharbor.beck.marshal.JavaBeanMarshaller
          extended bycom.openharbor.beck.marshal.XPathReferentsMarshaller
All Implemented Interfaces:
Configurable, Marshaller

public abstract class XPathReferentsMarshaller
extends JavaBeanMarshaller
implements Configurable

Enables XPathMarshaller, by computing XPaths from a graph of objects.


Field Summary
protected  ObjectOHXPathMap.Policy policy
           
static XMLName REFERENT_CLASSES
          The name of the configuration attribute whose value is a space-separated list of classes whose XPaths are desired.
 
Fields inherited from class com.openharbor.beck.marshal.DefaultMarshaller
log
 
Fields inherited from interface com.openharbor.beck.configure.Configurable
ATTRIBUTE, CLASS_IS_ARRAY, DIRECTION, ELEMENT, JAVA_TO_XML, NAMESPACE, NONE, PARENT_CLASS, PARENT_ELEMENT, PREDICATE, PREFIX, SCHEMA_LOCATION, TEXT, XML_TO_JAVA
 
Constructor Summary
protected XPathReferentsMarshaller(ObjectOHXPathMap.Policy policy)
           
 
Method Summary
 java.util.Map getConfiguration()
           
 void setConfiguration(java.util.Map configuration)
           
protected  void writeAsElement(MapToXML mapper, java.lang.Object parent, Getter getter, java.lang.Object source, XMLThing tag, XMLWriter writer)
          Traverse the entire object graph (as when copying to XML).
 
Methods inherited from class com.openharbor.beck.marshal.JavaBeanMarshaller
getProperties, orderElements, orderElements
 
Methods inherited from class com.openharbor.beck.marshal.DefaultMarshaller
getText, getXML, getXMLSource, marshal, marshalMember, writeNull, writeSimply
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REFERENT_CLASSES

public static final XMLName REFERENT_CLASSES
The name of the configuration attribute whose value is a space-separated list of classes whose XPaths are desired. If this attribute is configured, the set of XPaths will be restricted to those that map from objects whose class (or base class or interface) is named in this list.


policy

protected ObjectOHXPathMap.Policy policy
Constructor Detail

XPathReferentsMarshaller

protected XPathReferentsMarshaller(ObjectOHXPathMap.Policy policy)
Method Detail

getConfiguration

public java.util.Map getConfiguration()
Specified by:
getConfiguration in interface Configurable

setConfiguration

public void setConfiguration(java.util.Map configuration)
Specified by:
setConfiguration in interface Configurable

writeAsElement

protected void writeAsElement(MapToXML mapper,
                              java.lang.Object parent,
                              Getter getter,
                              java.lang.Object source,
                              XMLThing tag,
                              XMLWriter writer)
                       throws java.lang.Exception
Traverse the entire object graph (as when copying to XML). For each object whose class matches a configured set of classes, compute and store an XPath (in a Map from ObjectIdentity to XPath). Then traverse the object graph again and copy to XML, using the previously computed Map to supply the XPaths.

Overrides:
writeAsElement in class JavaBeanMarshaller
Throws:
java.lang.Exception