|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.waveset.util.AbstractXmlObject
An abstract class that implements the XmlObject interface and provides a set of default implementations for some methods. You normally want to extend this rather than implement XmlObject, though you may be forced to implement XmlObject if you're already extending some other class.
This got a lot simpler as it evolved, we may be able to get rid of this and move some of the stuff to XmlUtil.
Implements Referenceable
so that any AbstractXmlObject
can be bound into a JNDI service provider.
Field Summary | |
protected boolean |
_trace
Debug flag |
static java.lang.String |
code_id
|
Constructor Summary | |
AbstractXmlObject()
|
Method Summary | |
static void |
addXmlHeader(java.lang.StringBuffer b,
java.lang.String doctypeName)
Adds a standard XML header, DOCTYPE statement and element start tag. |
java.lang.Object |
cloneObject()
Make a deep copy of an object by serializing it and parsing the serialization into a new object. |
void |
dump()
Dump an XML for an object to the console. |
void |
dumpFile(java.lang.String file)
Dump the XML for an object to a file. |
abstract java.lang.String |
getElementName()
Return the element name. |
javax.naming.Reference |
getReference()
|
protected static void |
println(java.lang.Object o)
Ubiquitous macro |
void |
setTrace(boolean b)
|
java.lang.String |
toIdentityString()
|
java.lang.String |
toVerboseString()
|
java.lang.String |
toVerboseString(java.lang.String indent)
|
java.lang.String |
toXml()
A default implementation for rendering as a valid XML document. |
void |
toXml(java.lang.StringBuffer b)
This isn't defined in the XmlObject interface, but its used a lot in older code, so provide an implementation to ease the transition. |
abstract void |
toXml(java.lang.StringBuffer b,
int indent)
Serialize into a buffer with optional indentation. |
static java.lang.String |
toXml(XmlObject obj)
Renders the full XML for an object, including header and DOCTYPE statement. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String code_id
protected boolean _trace
Constructor Detail |
public AbstractXmlObject()
Method Detail |
public static void addXmlHeader(java.lang.StringBuffer b, java.lang.String doctypeName)
toXml
method below prior to calling
the toXml method of a subclass. Subclasses may also call it
if they want to overload the generation of the header
or DOCTYPE for some reason, though there should be no
reason to do so.
Direct implementations of XmlObject that can't subclass AbstractXmlObject may also call this in their required implementations of toXml.
public static java.lang.String toXml(XmlObject obj)
This is provided as a static method so that it may be called
from the required toXml
method of classes that
implement XmlObject rather than extend AbstractXmlObject.
We'll ask the object for its element name which we then use in the DOCTYPE. If it doesn't give us one, we'll wrap it in our generic container element.
public java.lang.Object cloneObject() throws WavesetException
WavesetException
public void dump()
public void dumpFile(java.lang.String file)
public void setTrace(boolean b)
protected static void println(java.lang.Object o)
public abstract java.lang.String getElementName()
getElementName
in interface XmlObject
public abstract void toXml(java.lang.StringBuffer b, int indent)
toXml
in interface XmlObject
b
- target bufferindent
- amount of indentationpublic java.lang.String toXml()
toXml
in interface XmlObject
public void toXml(java.lang.StringBuffer b)
public javax.naming.Reference getReference() throws javax.naming.NamingException
getReference
in interface javax.naming.Referenceable
javax.naming.NamingException
public java.lang.String toVerboseString()
public java.lang.String toIdentityString()
public java.lang.String toVerboseString(java.lang.String indent)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |