|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An interface for objects that are able to serialize and deserialize themselves using XML. Objects that either implement this interface, or extend AbstractXmlObject may be "contained" by other objects that support XML serialization.
Adapted from similar code in the PersistentObject class so we can support lighter weight object serialization, without having to make everything a PersistentObject.
Normally you will extend AbstractXmlObject to take advantage of default implementations of some of the methods. But if you're already inheriting something else, you may implement this interface and copy the default implemetnations from AbstractXmlObject.
Note that rather than requiring classes to implement a factory method that parses an Element and returning an object, we will use reflection to look for a class constructor that takes an Element argument. Unfortunately we can't define constructor signatures in an interface, so we have no way to check this at compile time.
Field Summary | |
static java.lang.String |
code_id
This is only public so that it can be contained in an interface. |
Method Summary | |
java.lang.String |
getElementName()
Objects must provide the name of the XML element that will be used in their serialized representation. |
java.lang.String |
toXml()
Objects must be able to render themselves as valid XML documents including a header and DOCTYPE. |
void |
toXml(java.lang.StringBuffer b,
int indent)
Objects must be able to render themselves as XML into a string buffer, with an optional amount of indentation. |
Field Detail |
public static final java.lang.String code_id
Method Detail |
public java.lang.String getElementName()
public java.lang.String toXml()
public void toXml(java.lang.StringBuffer b, int indent)
b
- target bufferindent
- amount of indentation
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |