|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.domain.DomainObjectTraversal
com.arsdigita.domain.DomainObjectXMLRenderer
An implementation of DomainObjectTraversal that generates an XML tree representing the DomainObject. The output format of the XML can be controlled using the various setWrapXXX methods detailed below.
Nested Class Summary |
Nested classes inherited from class com.arsdigita.domain.DomainObjectTraversal |
DomainObjectTraversal.AdapterKey |
Field Summary |
Fields inherited from class com.arsdigita.domain.DomainObjectTraversal |
LINK_NAME |
Constructor Summary | |
DomainObjectXMLRenderer(Element root)
Creates a new DomainObject XML renderer that outputs XML into the element passed into the constructor. |
Method Summary | |
protected void |
beginAssociation(DomainObject obj,
String path,
Property property)
Method called when the processing of an association starts |
protected void |
beginObject(DomainObject obj,
String path)
Method called when the processing of an object starts |
protected void |
beginRole(DomainObject obj,
String path,
Property property)
Method called when the processing of a role starts |
protected void |
endAssociation(DomainObject obj,
String path,
Property property)
Method called when the procesing of an association completes |
protected void |
endObject(DomainObject obj,
String path)
Method called when the procesing of an object completes |
protected void |
endRole(DomainObject obj,
String path,
Property property)
Method called when the procesing of a role completes |
static DomainObjectXMLFormatter |
findFormatter(ObjectType type,
String context)
Retrieves the closest matching traversal formatter for an object type in a given context. |
protected String |
format(DomainObject obj,
String path,
Property prop,
Object value)
|
protected Element |
getCurrentElement()
|
static DomainObjectXMLFormatter |
getFormatter(ObjectType type,
String context)
Retrieves the traversal formatter for an object type in a given context. |
protected void |
handleAttribute(DomainObject obj,
String path,
Property property)
Method called when an attribute is encountered |
boolean |
isWrappingAttributes()
|
boolean |
isWrappingObjects()
|
boolean |
isWrappingRoot()
|
protected Element |
newElement(Element parent,
String name)
|
protected Element |
newElement(Element parent,
String name,
Element copy)
|
static void |
registerFormatter(ObjectType type,
DomainObjectXMLFormatter formatter,
String context)
Registers a traversal formatter for an object type in a given context. |
static void |
registerFormatter(String type,
DomainObjectXMLFormatter formatter,
String context)
Registers a traversal formatter for an object type in a given context. |
protected void |
revisitObject(DomainObject obj,
String path)
Method called when a previously visited object is encountered for a second time. |
void |
setNamespace(String prefix,
String uri)
|
void |
setRevisitFullObject(boolean value)
Determines XML output used for objects. |
void |
setWrapAttributes(boolean value)
Determines XML output used for scalar attributes. |
void |
setWrapObjects(boolean value)
Determines XML output used for objects. |
void |
setWrapRoot(boolean value)
Determines XML output for root object. |
static void |
unregisterFormatter(ObjectType type,
String context)
Unregisteres a traversal formatter for an object type in a given context |
static void |
unregisterFormatter(String type,
String context)
Unregisteres a traversal formatter for an object type in a given context |
protected void |
walk(DomainObject obj,
String context,
DomainObjectTraversalAdapter adapter)
|
Methods inherited from class com.arsdigita.domain.DomainObjectTraversal |
appendToPath, beginLink, endLink, findAdapter, lookupAdapter, nameFromPath, parentFromPath, registerAdapter, registerAdapter, unregisterAdapter, unregisterAdapter, walk |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DomainObjectXMLRenderer(Element root)
root
- the XML element in which to output childrenMethod Detail |
public static void registerFormatter(ObjectType type, DomainObjectXMLFormatter formatter, String context)
type
- the object type whose items will be traversedformatter
- the formatter for controlling object traversalcontext
- the context in which the formatter should be usedpublic static void unregisterFormatter(ObjectType type, String context)
type
- the object type whose items will be traversedcontext
- the context in which the formatter should be usedpublic static void registerFormatter(String type, DomainObjectXMLFormatter formatter, String context)
type
- the object type whose items will be traversedformatter
- the formatter for controlling object traversalcontext
- the context in which the formatter should be usedpublic static void unregisterFormatter(String type, String context)
type
- the object type whose items will be traversedcontext
- the context in which the formatter should be usedpublic static DomainObjectXMLFormatter getFormatter(ObjectType type, String context)
type
- the object type to lookupcontext
- the formatter contextpublic static DomainObjectXMLFormatter findFormatter(ObjectType type, String context)
type
- the object type to search forcontext
- the formatter contextpublic void setNamespace(String prefix, String uri)
protected String format(DomainObject obj, String path, Property prop, Object value)
protected void walk(DomainObject obj, String context, DomainObjectTraversalAdapter adapter)
walk
in class DomainObjectTraversal
public void setWrapRoot(boolean value)
public void setWrapObjects(boolean value)
public void setWrapAttributes(boolean value)
public void setRevisitFullObject(boolean value)
public boolean isWrappingAttributes()
public boolean isWrappingObjects()
public boolean isWrappingRoot()
protected void beginObject(DomainObject obj, String path)
DomainObjectTraversal
beginObject
in class DomainObjectTraversal
protected void endObject(DomainObject obj, String path)
DomainObjectTraversal
endObject
in class DomainObjectTraversal
protected void revisitObject(DomainObject obj, String path)
DomainObjectTraversal
revisitObject
in class DomainObjectTraversal
protected void handleAttribute(DomainObject obj, String path, Property property)
DomainObjectTraversal
handleAttribute
in class DomainObjectTraversal
protected void beginRole(DomainObject obj, String path, Property property)
DomainObjectTraversal
beginRole
in class DomainObjectTraversal
protected void endRole(DomainObject obj, String path, Property property)
DomainObjectTraversal
endRole
in class DomainObjectTraversal
protected void beginAssociation(DomainObject obj, String path, Property property)
DomainObjectTraversal
beginAssociation
in class DomainObjectTraversal
protected void endAssociation(DomainObject obj, String path, Property property)
DomainObjectTraversal
endAssociation
in class DomainObjectTraversal
protected Element getCurrentElement()
protected Element newElement(Element parent, String name)
protected Element newElement(Element parent, String name, Element copy)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |