java.lang.Object | |
↳ | org.apache.commons.betwixt.io.AbstractBeanWriter |
Known Direct Subclasses |
Abstract superclass for bean writers. This class encapsulates the processing logic. Subclasses provide implementations for the actual expression of the xml.
This class is intended to be used by subclassing: concrete subclasses perform the actual writing by providing suitable implementations for the following methods inspired by SAX:
start()
- called when processing beginsstartElement(WriteContext, String, String, String, Attributes)
- called when the start of an element
should be writtenbodyText(WriteContext, String)
- called when the start of an element
should be writtenendElement(WriteContext, String, String, String)
- called when the end of an element
should be writtenend()
- called when processing has been completedNote that this class contains many deprecated versions of the writing API. These will be removed soon so care should be taken to use the latest version.
Note that this class is designed to be used
in a single threaded environment. When used in multi-threaded
environments, use of a common XMLIntrospector
and pooled writer instances should be considered.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Marks the start of the bean writing.
| |||||||||||
Gets the current logging implementation. | |||||||||||
Gets the dynamic configuration setting to be used for bean reading.
| |||||||||||
Get
IDGenerator implementation used to
generate ID attribute values . | |||||||||||
Gets whether empty elements should be written into the output. | |||||||||||
This method is deprecated.
0.5 use
getMapIDs()
| |||||||||||
Gets the introspector used. | |||||||||||
Set the current logging implementation. | |||||||||||
Sets the dynamic configuration setting to be used for bean reading.
| |||||||||||
Set
IDGenerator implementation
used to generate ID attribute values. | |||||||||||
Sets whether empty elements should be written into the output. | |||||||||||
This method is deprecated.
0.5 use
setMapIDs(boolean)
| |||||||||||
Sets the introspector to be used. | |||||||||||
Marks the start of the bean writing.
| |||||||||||
Writes the bean using the mapping specified in the | |||||||||||
Writes the given bean to the current stream using the XML introspector. | |||||||||||
Writes the given bean to the current stream
using the given |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This method is deprecated.
0.5 use
bodyText(WriteContext, String)
| |||||||||||
Writes body text
| |||||||||||
This method is deprecated.
0.5 use
endElement(WriteContext, String, String, String)
| |||||||||||
Writes the end tag for an element
| |||||||||||
This method is deprecated.
0.5 replaced by new SAX inspired API
| |||||||||||
This method is deprecated.
0.5 replaced by new SAX inspired API
| |||||||||||
This method is deprecated.
0.5 replaced by new SAX inspired API
| |||||||||||
This method is deprecated.
0.5 replaced by new SAX inspired API
| |||||||||||
This method is deprecated.
0.5 replaced by new SAX inspired API
| |||||||||||
This method is deprecated.
0.5 replaced by new SAX inspired API
| |||||||||||
This method is deprecated.
0.5 replaced by new SAX inspired API
| |||||||||||
This method is deprecated.
0.5 replaced by new SAX inspired API
| |||||||||||
This method is deprecated.
0.5 replaced by new SAX inspired API
| |||||||||||
This method is deprecated.
0.5 replaced by new SAX inspired API
| |||||||||||
Pops the top bean off from the ancestry stack
| |||||||||||
Pushes the bean onto the ancestry stack.
| |||||||||||
Writes the start tag for an element.
| |||||||||||
This method is deprecated.
0.5 use
startElement(WriteContext, String, String, String, Attributes)
| |||||||||||
This method is deprecated.
0.5 replaced by new SAX inspired API
| |||||||||||
This method is deprecated.
0.5 replaced by new SAX inspired API
| |||||||||||
This method is deprecated.
0.5 replaced by new SAX inspired API
| |||||||||||
This method is deprecated.
0.5 replaced by new SAX inspired API
| |||||||||||
This method is deprecated.
0.5 replaced by new SAX inspired API
| |||||||||||
This method is deprecated.
0.5 replaced by new SAX inspired API
| |||||||||||
This method is deprecated.
0.5 replaced by new BeanWriter API
| |||||||||||
This method is deprecated.
0.5 replaced by new SAX inspired API
| |||||||||||
This method is deprecated.
0.5 replaced by new SAX inspired API
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Marks the start of the bean writing. By default doesn't do anything, but can be used to do extra end processing
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
Gets the current logging implementation.
Log
implementation which this class logs to
Gets the dynamic configuration setting to be used for bean reading.
Get IDGenerator
implementation used to
generate ID
attribute values .
ID
attribute generation
Gets whether empty elements should be written into the output.
An empty element is one that has no attributes, no child elements
and no body text.
For example, <element/>
is an empty element but
<element attr='value'/>
is not.
This method is deprecated.
0.5 use getMapIDs()
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 writtenGets 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 introspection
Set the current logging implementation.
log | Log implementation to use
|
---|
Sets the dynamic configuration setting to be used for bean reading.
bindingConfiguration | the BindingConfiguration settings, not null |
---|
Set 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 generation
|
---|
Sets whether empty elements should be written into the output.
An empty element is one that has no attributes, no child elements
and no body text.
For example, <element/>
is an empty element but
<element attr='value'/>
is not.
writeEmptyElements | true if empty elements should be written into the output |
---|
This method is deprecated.
0.5 use setMapIDs(boolean)
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.
writeIDs | true if ID 's and IDREF 's should be written |
---|
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 introspector |
---|
Marks the start of the bean writing. By default doesn't do anything, but can be used to do extra start processing
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
Writes the bean using the mapping specified in the InputSource
.
Note: that the custom mapping will not
be registered for later use. Please use register(Class, InputSource)
to register the custom mapping for the class and then call
write(Object)
.
bean | Object to be written as xml, not null |
---|---|
source | InputSource/code> containing an xml document
specifying the mapping to be used (in the usual way), not null |
IOException | |
SAXException | |
IntrospectionException | |
IOException | |
SAXException |
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 getMapIDs()
setting of the BindingConfiguration is false.
bean | write out representation of this bean |
---|
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
IntrospectionException | if a java beans introspection problem occurs |
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 getMapIDs()
setting of the BindingConfiguration
is false.
qualifiedName | the string naming root element |
---|---|
bean | the Object to write out as xml |
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
IntrospectionException | if a java beans introspection problem occurs |
This method is deprecated.
0.5 use bodyText(WriteContext, String)
Writes body text
text | the body text to be written |
---|
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
Writes body text
text | the body text to be written |
---|
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
This method is deprecated.
0.5 use endElement(WriteContext, String, String, String)
Writes the end tag for an element
uri | the element's namespace uri |
---|---|
localName | the element's local name |
qName | the element's qualified name |
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
Writes the end tag for an element
uri | the element's namespace uri |
---|---|
localName | the element's local name |
qName | the element's qualified name |
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
This method is deprecated.
0.5 replaced by new SAX inspired API
Express an attribute
qualifiedName | the qualified name of the attribute |
---|---|
value | the attribute value |
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
This method is deprecated.
0.5 replaced by new SAX inspired API
Express an attribute
namespaceUri | the namespace uri |
---|---|
localName | the local name |
qualifiedName | the qualified name of the attribute |
value | the attribute value |
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
This method is deprecated.
0.5 replaced by new SAX inspired API
Express body text
text | the string to write out as the body of the current element |
---|
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
This method is deprecated.
0.5 replaced by new SAX inspired API
Express an empty element end.
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
This method is deprecated.
0.5 replaced by new SAX inspired API
Express an element end tag (with given name)
uri | the namespace uri of the element close tag |
---|---|
localName | the local name of the element close tag |
qualifiedName | the qualified name for the element to be closed |
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
This method is deprecated.
0.5 replaced by new SAX inspired API
Express an element end tag (with given name)
qualifiedName | the qualified name for the element to be closed |
---|
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
This method is deprecated.
0.5 replaced by new SAX inspired API
Express an element tag start using given qualified name.
uri | the namespace uri |
---|---|
localName | the local name for this element |
qualifiedName | the qualified name of the element to be expressed |
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
This method is deprecated.
0.5 replaced by new SAX inspired API
Express an element tag start using given qualified name.
qualifiedName | the qualified name of the element to be expressed |
---|
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
This method is deprecated.
0.5 replaced by new SAX inspired API
Express a closing tag.
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
This method is deprecated.
0.5 replaced by new SAX inspired API
Get the indentation for the current element. Used for pretty priting.
Pops the top bean off from the ancestry stack
Pushes the bean onto the ancestry stack. If IDs are not being written, then check for cyclic references.
bean | push this bean onto the ancester stack |
---|
Writes the start tag for an element.
uri | the element's namespace uri |
---|---|
localName | the element's local name |
qName | the element's qualified name |
attr | the element's attributes |
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
This method is deprecated.
0.5 use startElement(WriteContext, String, String, String, Attributes)
Writes the start tag for an element.
uri | the element's namespace uri |
---|---|
localName | the element's local name |
qName | the element's qualified name |
attr | the element's attributes |
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
This method is deprecated.
0.5 replaced by new SAX inspired API
Writes the given element
qualifiedName | qualified name to use for the element |
---|---|
elementDescriptor | the ElementDescriptor describing the element |
context | the Context to use to evaluate the bean expressions |
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
IntrospectionException | if a java beans introspection problem occurs |
This method is deprecated.
0.5 replaced by new SAX inspired API
Writes the given element adding an ID attribute
qualifiedName | qualified name to use for the element |
---|---|
elementDescriptor | the ElementDescriptor describing the element |
context | the Context to use to evaluate the bean expressions |
idAttribute | the qualified name of the ID attribute |
idValue | the value for the ID attribute |
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
IntrospectionException | if a java beans introspection problem occurs |
This method is deprecated.
0.5 replaced by new SAX inspired API
Writes an attribute declaration
attributeDescriptor | the AttributeDescriptor to be written as xml |
---|---|
context | the Context to use to evaluation bean expressions |
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
This method is deprecated.
0.5 replaced by new SAX inspired API
Writes the attribute declarations
elementDescriptor | the ElementDescriptor to be written out as xml |
---|---|
context | the Context to use to evaluation bean expressions |
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
This method is deprecated.
0.5 replaced by new SAX inspired API
Writes the element content.
elementDescriptor | the ElementDescriptor to write as xml |
---|---|
context | the Context to use to evaluate the bean expressions |
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
IntrospectionException | if a java beans introspection problem occurs |
This method is deprecated.
0.5 replaced by new SAX inspired API
Writes an element with a IDREF
attribute
qualifiedName | of the element with IDREF attribute |
---|---|
idrefAttributeName | the qualified name of the IDREF attribute |
idrefAttributeValue | the value for the IDREF attribute |
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
IntrospectionException | if a java beans introspection problem occurs |
This method is deprecated.
0.5 replaced by new BeanWriter API
Writes an indentation. This implementation does nothing but can be overridden by subclasses.
IOException | if the indent cannot be written |
---|
This method is deprecated.
0.5 replaced by new SAX inspired API
Writes a empty line. This implementation does nothing but can be overridden by subclasses.
IOException | if the line cannot be written |
---|
This method is deprecated.
0.5 replaced by new SAX inspired API
Write attributes, child elements and element end
qualifiedName | qualified name to use for the element |
---|---|
elementDescriptor | the ElementDescriptor describing the element |
context | the Context to use to evaluate the bean expressions |
IOException | if an IO problem occurs during writing |
---|---|
SAXException | if an SAX problem occurs during writing |
IntrospectionException | if a java beans introspection problem occurs |