|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nakedobjects.runtime.snapshot.XmlSnapshot
public final class XmlSnapshot
Traverses object graph from specified root, so that an XML representation of the graph can be returned.
Initially designed to allow snapshots to be easily created.
Typical use:
XmlSnapshot snapshot = new XmlSnapshot(customer); // where customer is a reference to an ANO
Element customerAsXml = snapshot.toXml(); // returns customer's fields, titles of simple references, number of items in collections
snapshot.include("placeOfBirth"); // navigates to ANO represented by simple reference "placeOfBirth"
snapshot.include("orders/product"); // navigates to all Orders of Customer, and from them for their products
Alternative fluent use:
XmlSnapshot snapshot =
XmlSnapshot.create(customer)
.includePath("placeOfBirth")
.include("orders/product")
.build();
Element customerAsXml = snapshot.toXml();
| Nested Class Summary | |
|---|---|
static class |
XmlSnapshot.Builder
|
| Constructor Summary | |
|---|---|
XmlSnapshot(NakedObject rootObject)
Start a snapshot at the root object, using own namespace manager. |
|
XmlSnapshot(NakedObject rootObject,
boolean addOids)
Start a snapshot at the root object, using own namespace manager. |
|
XmlSnapshot(NakedObject rootObject,
XmlSchema schema,
boolean addOids)
Start a snapshot at the root object, using supplied namespace manager. |
|
| Method Summary | |
|---|---|
static XmlSnapshot.Builder |
create(Snapshottable snapshottable)
|
NakedObject |
getObject()
|
XmlSchema |
getSchema()
|
java.lang.String |
getSchemaLocationFileName()
The name of the xsi:schemaLocation in the XML document. |
org.w3c.dom.Document |
getXmlDocument()
|
org.w3c.dom.Element |
getXmlElement()
The root element of getXmlDocument(). |
org.w3c.dom.Document |
getXsdDocument()
|
org.w3c.dom.Element |
getXsdElement()
The root element of getXsdDocument(). |
void |
include(java.lang.String path)
|
void |
include(java.lang.String path,
java.lang.String annotation)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XmlSnapshot(NakedObject rootObject)
public XmlSnapshot(NakedObject rootObject,
boolean addOids)
public XmlSnapshot(NakedObject rootObject,
XmlSchema schema,
boolean addOids)
| Method Detail |
|---|
public static XmlSnapshot.Builder create(Snapshottable snapshottable)
public NakedObject getObject()
public XmlSchema getSchema()
public java.lang.String getSchemaLocationFileName()
xsi:schemaLocation in the XML document.
Taken from the fullyQualifiedClassName (which also is used as the basis for the
targetNamespace.
Populated in appendXml(NakedObject).
public org.w3c.dom.Document getXmlDocument()
public org.w3c.dom.Element getXmlElement()
getXmlDocument(). Returns null until the snapshot has
actually been built.
public org.w3c.dom.Document getXsdDocument()
public org.w3c.dom.Element getXsdElement()
getXsdDocument(). Returns null until the snapshot has
actually been built.
public void include(java.lang.String path)
public void include(java.lang.String path,
java.lang.String annotation)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||