java.lang.Objectorg.apache.commons.betwixt.io.AbstractBeanWriter
org.apache.commons.betwixt.io.BeanWriter
BeanWriter outputs beans as XML to an io stream.
The output for each bean is an xml fragment (rather than a well-formed xml-document). This allows bean representations to be appended to a document by writing each in turn to the stream. So to create a well formed xml document, you'll need to write the prolog to the stream first. If you append more than one bean to the stream, then you'll need to add a wrapping root element as well.
The line ending to be used is set by #setEndOfLine .
The output can be formatted (with whitespace) for easy reading by calling #enablePrettyPrint . The output will be indented. The indent string used is set by #setIndent .
Bean graphs can sometimes contain cycles.
Care must be taken when serializing cyclic bean graphs
since this can lead to infinite recursion.
The approach taken by BeanWriter is to automatically
assign an ID attribute value to beans.
When a cycle is encountered,
an element is written that has the IDREF attribute set to the
id assigned earlier.
The names of the ID and IDREF attributes used
can be customized by the XMLBeanInfo.
The id's used can also be customized by the user
via IDGenerator subclasses.
The implementation used can be set by the IdGenerator property.
BeanWriter defaults to using SequentialIDGenerator
which supplies id values in numeric sequence.
If generated ID attribute values are not acceptable in the output,
then this can be disabled by setting the WriteIDs property to false.
If a cyclic reference is encountered in this case then a
CyclicReferenceException will be thrown.
When the WriteIDs property is set to false,
it is recommended that this exception is caught by the caller.
< - a href="mailto:jstrachan@apache.org">James Strachan< - a href="mailto:martin@mvdb.net">Martin van den Bemt| Constructor: |
|---|
Constructor uses |
Constuctor uses given
|
Constructor sets writer used for output.
|
Constuctor uses given
|
| Method from org.apache.commons.betwixt.io.BeanWriter Summary: |
|---|
| bodyText, close, enablePrettyPrint, endElement, escapeAttributeValue, escapeBodyValue, expressAttribute, expressBodyText, expressElementEnd, expressElementEnd, expressElementStart, expressTagClose, flush, getEndOfLine, getIndent, getInitialIndentLevel, getLog, getMixedContentEncodingStrategy, isEndTagForEmptyElement, setEndOfLine, setEndTagForEmptyElement, setIndent, setInitialIndentLevel, setLog, setMixedContentEncodingStrategy, startElement, write, writeIndent, writePrintln, writeXmlDeclaration |
| Methods from org.apache.commons.betwixt.io.AbstractBeanWriter: |
|---|
| bodyText, bodyText, end, endElement, endElement, expressAttribute, expressAttribute, expressBodyText, expressElementEnd, expressElementEnd, expressElementEnd, expressElementStart, expressElementStart, expressTagClose, getAbstractBeanWriterLog, getBindingConfiguration, getIdGenerator, getIndentLevel, getWriteEmptyElements, getWriteIDs, getXMLIntrospector, popBean, pushBean, setAbstractBeanWriterLog, setBindingConfiguration, setIdGenerator, setWriteEmptyElements, setWriteIDs, setXMLIntrospector, start, startElement, startElement, write, write, write, write, write, writeAttribute, writeAttributes, writeContent, writeIDREFElement, writeIndent, writePrintln, writeRestOfElement |
| Methods from java.lang.Object: |
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from org.apache.commons.betwixt.io.BeanWriter Detail: |
|---|
|
|
Switch on formatted output. This sets the end of line and the indent. The default is adding 2 spaces and a newline |
|
Deprecated! 0.5 - moved into utility class XMLUtils#escapeAttributeValue Escape the |
Deprecated! 0.5 - moved into utility class XMLUtils#escapeBodyValue Escape the |
Deprecated! 0.5 - replaced by new SAX inspired API
|
Deprecated! 0.5 - replaced by new SAX inspired API
|
Deprecated! 0.5 - replaced by new SAX inspired API
|
Deprecated! 0.5 - replaced by new SAX inspired API
|
Deprecated! 0.5 - replaced by new SAX inspired API
|
Deprecated! 0.5 - replaced by new SAX inspired API
|
|
|
|
|
Set the log implementation used. |
|
Should an end tag be added for each empty element?
When this property is false then empty elements will
be written as |
|
<element-name/gt;.
When this property is true then empty elements will
be written as <element-namegt;
</element-namegt;. |
|
|
Set the log implementation used. |
|
|
|
Deprecated! 0.5 - replaced by new SAX inspired API
indent's to the current indentLevel |
Deprecated! 0.5 - replaced by new SAX inspired API
endOfLine. |
|