|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.apache.commons.betwixt.io.AbstractBeanWriter
Abstract superclass for bean writers. This class encapsulates the processing logic. Subclasses provide implementations for the actual expression of the xml.
| Constructor Summary | |
AbstractBeanWriter()
|
|
| Method Summary | |
void |
end()
Marks the start of the bean writing. |
protected abstract void |
expressAttribute(java.lang.String qualifiedName,
java.lang.String value)
Express an attribute |
protected abstract void |
expressBodyText(java.lang.String text)
Express body text |
protected abstract void |
expressElementEnd()
Express an empty element end. |
protected abstract void |
expressElementEnd(java.lang.String qualifiedName)
Express an element end tag (with given name) |
protected abstract void |
expressElementStart(java.lang.String qualifiedName)
Express an element tag start using given qualified name. |
protected abstract void |
expressTagClose()
Express a closing tag. |
org.apache.commons.logging.Log |
getAbstractBeanWriterLog()
Gets the current logging implementation. |
IDGenerator |
getIdGenerator()
Get IDGenerator implementation used to
generate ID attribute values . |
protected int |
getIndentLevel()
Get the indentation for the current element. |
boolean |
getWriteIDs()
Should generated ID attribute values be added to the elements? |
XMLIntrospector |
getXMLIntrospector()
Gets the introspector used. |
protected java.lang.Object |
popBean()
Pops the top bean off from the ancestry stack |
protected void |
pushBean(java.lang.Object bean)
Pushes the bean onto the ancestry stack. |
void |
setAbstractBeanWriterLog(org.apache.commons.logging.Log log)
Set the current logging implementation. |
void |
setIdGenerator(IDGenerator idGenerator)
Set IDGenerator implementation
used to generate ID attribute values. |
void |
setWriteIDs(boolean writeIDs)
Set whether generated ID attribute values should be added to the elements
If this property is set to false, then CyclicReferenceException
will be thrown whenever a cyclic occurs in the bean graph. |
void |
setXMLIntrospector(XMLIntrospector introspector)
Sets the introspector to be used. |
void |
start()
Marks the start of the bean writing. |
void |
write(java.lang.Object bean)
Writes the given bean to the current stream using the XML introspector. |
protected void |
write(java.lang.String qualifiedName,
ElementDescriptor elementDescriptor,
Context context)
Writes the given element |
protected void |
write(java.lang.String qualifiedName,
ElementDescriptor elementDescriptor,
Context context,
java.lang.String idAttribute,
java.lang.String idValue)
Writes the given element adding an ID attribute |
void |
write(java.lang.String qualifiedName,
java.lang.Object bean)
Writes the given bean to the current stream using the given qualifiedName. |
protected void |
writeAttribute(AttributeDescriptor attributeDescriptor,
Context context)
Writes an attribute declaration |
protected void |
writeAttributes(ElementDescriptor elementDescriptor,
Context context)
Writes the attribute declarations |
protected boolean |
writeContent(ElementDescriptor elementDescriptor,
Context context)
Writes the element content. |
protected void |
writeIDREFElement(java.lang.String qualifiedName,
java.lang.String idrefAttributeName,
java.lang.String idrefAttributeValue)
Writes an element with a IDREF attribute |
protected void |
writeIndent()
Writes an indentation. |
protected void |
writePrintln()
Writes a empty line. |
protected void |
writeRestOfElement(java.lang.String qualifiedName,
ElementDescriptor elementDescriptor,
Context context)
Write attributes, child elements and element end |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public AbstractBeanWriter()
| Method Detail |
public void start()
throws java.io.IOException,
org.xml.sax.SAXException
java.io.IOException - if an IO problem occurs during writingorg.xml.sax.SAXException - if an SAX problem occurs during writing
public void end()
throws java.io.IOException,
org.xml.sax.SAXException
java.io.IOException - if an IO problem occurs during writingorg.xml.sax.SAXException - if an SAX problem occurs during writing
public void write(java.lang.Object bean)
throws java.io.IOException,
org.xml.sax.SAXException,
java.beans.IntrospectionException
Writes the given bean to the current stream using the XML introspector.
This writes an xml fragment representing the bean to the current stream.
This method will throw a CyclicReferenceException when a cycle
is encountered in the graph only if the WriteIDs
property is false.
bean - write out representation of this beanCyclicReferenceException - when a cyclic reference is encounteredjava.io.IOException - if an IO problem occurs during writingorg.xml.sax.SAXException - if an SAX problem occurs during writingjava.beans.IntrospectionException - if a java beans introspection problem occurs
public void write(java.lang.String qualifiedName,
java.lang.Object bean)
throws java.io.IOException,
org.xml.sax.SAXException,
java.beans.IntrospectionException
Writes the given bean to the current stream
using the given qualifiedName.
This method will throw a CyclicReferenceException when a cycle
is encountered in the graph only if the WriteIDs
property is false.
qualifiedName - the string naming root elementbean - the Object to write out as xmlCyclicReferenceException - when a cyclic reference is encounteredjava.io.IOException - if an IO problem occurs during writingorg.xml.sax.SAXException - if an SAX problem occurs during writingjava.beans.IntrospectionException - if a java beans introspection problem occurspublic IDGenerator getIdGenerator()
IDGenerator implementation used to
generate ID attribute values .ID attribute generationprotected int getIndentLevel()
public void setIdGenerator(IDGenerator idGenerator)
IDGenerator implementation
used to generate ID attribute values.
This property can be used to customize the algorithm used for generation.idGenerator - use this implementation for ID attribute generationpublic boolean getWriteIDs()
Should generated ID attribute values be added to the elements?
If IDs are not being written then if a cycle is encountered in the bean graph,
then a CyclicReferenceException will be thrown by the write method.
ID and IDREF attributes are to be writtenpublic void setWriteIDs(boolean writeIDs)
ID attribute values should be added to the elements
If this property is set to false, then CyclicReferenceException
will be thrown whenever a cyclic occurs in the bean graph.writeIDs - true if ID's and IDREF's should be writtenpublic XMLIntrospector getXMLIntrospector()
Gets the introspector used.
The XMLBeanInfo used to map each bean is
created by the XMLIntrospector.
One way in which the mapping can be customized is
by altering the XMLIntrospector.
XMLIntrospector used for introspectionpublic void setXMLIntrospector(XMLIntrospector introspector)
Sets the introspector to be used.
The XMLBeanInfo used to map each bean is
created by the XMLIntrospector.
One way in which the mapping can be customized is by
altering the XMLIntrospector.
introspector - use this introspectorpublic final org.apache.commons.logging.Log getAbstractBeanWriterLog()
Gets the current logging implementation.
Log implementation which this class logs topublic final void setAbstractBeanWriterLog(org.apache.commons.logging.Log log)
Set the current logging implementation.
log - Log implementation to use
protected abstract void expressElementStart(java.lang.String qualifiedName)
throws java.io.IOException,
org.xml.sax.SAXException
qualifiedName - the qualified name of the element to be expressedjava.io.IOException - if an IO problem occurs during writingorg.xml.sax.SAXException - if an SAX problem occurs during writing
protected abstract void expressTagClose()
throws java.io.IOException,
org.xml.sax.SAXException
java.io.IOException - if an IO problem occurs during writingorg.xml.sax.SAXException - if an SAX problem occurs during writing
protected abstract void expressElementEnd(java.lang.String qualifiedName)
throws java.io.IOException,
org.xml.sax.SAXException
qualifiedName - the qualified name for the element to be closedjava.io.IOException - if an IO problem occurs during writingorg.xml.sax.SAXException - if an SAX problem occurs during writing
protected abstract void expressElementEnd()
throws java.io.IOException,
org.xml.sax.SAXException
java.io.IOException - if an IO problem occurs during writingorg.xml.sax.SAXException - if an SAX problem occurs during writing
protected abstract void expressBodyText(java.lang.String text)
throws java.io.IOException,
org.xml.sax.SAXException
text - the string to write out as the body of the current elementjava.io.IOException - if an IO problem occurs during writingorg.xml.sax.SAXException - if an SAX problem occurs during writing
protected abstract void expressAttribute(java.lang.String qualifiedName,
java.lang.String value)
throws java.io.IOException,
org.xml.sax.SAXException
qualifiedName - the qualified name of the attributevalue - the attribute valuejava.io.IOException - if an IO problem occurs during writingorg.xml.sax.SAXException - if an SAX problem occurs during writing
protected void write(java.lang.String qualifiedName,
ElementDescriptor elementDescriptor,
Context context)
throws java.io.IOException,
org.xml.sax.SAXException,
java.beans.IntrospectionException
qualifiedName - qualified name to use for the elementelementDescriptor - the ElementDescriptor describing the elementcontext - the Context to use to evaluate the bean expressionsjava.io.IOException - if an IO problem occurs during writingorg.xml.sax.SAXException - if an SAX problem occurs during writingjava.beans.IntrospectionException - if a java beans introspection problem occurs
protected void write(java.lang.String qualifiedName,
ElementDescriptor elementDescriptor,
Context context,
java.lang.String idAttribute,
java.lang.String idValue)
throws java.io.IOException,
org.xml.sax.SAXException,
java.beans.IntrospectionException
qualifiedName - qualified name to use for the elementelementDescriptor - the ElementDescriptor describing the elementcontext - the Context to use to evaluate the bean expressionsidAttribute - the qualified name of the ID attributeidValue - the value for the ID attributejava.io.IOException - if an IO problem occurs during writingorg.xml.sax.SAXException - if an SAX problem occurs during writingjava.beans.IntrospectionException - if a java beans introspection problem occurs
protected void writeRestOfElement(java.lang.String qualifiedName,
ElementDescriptor elementDescriptor,
Context context)
throws java.io.IOException,
org.xml.sax.SAXException,
java.beans.IntrospectionException
qualifiedName - qualified name to use for the elementelementDescriptor - the ElementDescriptor describing the elementcontext - the Context to use to evaluate the bean expressionsjava.io.IOException - if an IO problem occurs during writingorg.xml.sax.SAXException - if an SAX problem occurs during writingjava.beans.IntrospectionException - if a java beans introspection problem occurs
protected void writeIDREFElement(java.lang.String qualifiedName,
java.lang.String idrefAttributeName,
java.lang.String idrefAttributeValue)
throws java.io.IOException,
org.xml.sax.SAXException,
java.beans.IntrospectionException
IDREF attributequalifiedName - of the element with IDREF attributeidrefAttributeName - the qualified name of the IDREF attributeidrefAttributeValue - the value for the IDREF attributejava.io.IOException - if an IO problem occurs during writingorg.xml.sax.SAXException - if an SAX problem occurs during writingjava.beans.IntrospectionException - if a java beans introspection problem occurs
protected boolean writeContent(ElementDescriptor elementDescriptor,
Context context)
throws java.io.IOException,
org.xml.sax.SAXException,
java.beans.IntrospectionException
elementDescriptor - the ElementDescriptor to write as xmlcontext - the Context to use to evaluate the bean expressionsjava.io.IOException - if an IO problem occurs during writingorg.xml.sax.SAXException - if an SAX problem occurs during writingjava.beans.IntrospectionException - if a java beans introspection problem occurs
protected void writeAttributes(ElementDescriptor elementDescriptor,
Context context)
throws java.io.IOException,
org.xml.sax.SAXException
elementDescriptor - the ElementDescriptor to be written out as xmlcontext - the Context to use to evaluation bean expressionsjava.io.IOException - if an IO problem occurs during writingorg.xml.sax.SAXException - if an SAX problem occurs during writing
protected void writeAttribute(AttributeDescriptor attributeDescriptor,
Context context)
throws java.io.IOException,
org.xml.sax.SAXException
attributeDescriptor - the AttributeDescriptor to be written as xmlcontext - the Context to use to evaluation bean expressionsjava.io.IOException - if an IO problem occurs during writingorg.xml.sax.SAXException - if an SAX problem occurs during writing
protected void writePrintln()
throws java.io.IOException
java.io.IOException - if the line cannot be written
protected void writeIndent()
throws java.io.IOException
java.io.IOException - if the indent cannot be writtenprotected void pushBean(java.lang.Object bean)
bean - push this bean onto the ancester stackCyclicReferenceException - if there is an identical bean already on the stackprotected java.lang.Object popBean()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||