com.openharbor.beck.marshal
Class XPathReferentsMarshaller
java.lang.Object
com.openharbor.beck.marshal.DefaultMarshaller
com.openharbor.beck.marshal.JavaBeanMarshaller
com.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.
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 |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
XPathReferentsMarshaller
protected XPathReferentsMarshaller(ObjectOHXPathMap.Policy policy)
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