Java Doc for AbstractBeanWriter.java in  » Library » Apache-commons-betwixt-0.8-src » org » apache » commons » betwixt » io » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Library » Apache commons betwixt 0.8 src » org.apache.commons.betwixt.io 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.betwixt.io.AbstractBeanWriter

All known Subclasses:   org.apache.commons.betwixt.io.BeanWriter,  org.apache.commons.betwixt.io.SAXBeanWriter,
AbstractBeanWriter
abstract public class AbstractBeanWriter (Code)

Abstract superclass for bean writers. This class encapsulates the processing logic. Subclasses provide implementations for the actual expression of the xml.

SAX Inspired Writing API

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:

Note 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.


author:
   Robert Burrell Donkin




Method Summary
protected  voidbodyText(WriteContext context, String text)
    
protected  voidbodyText(String text)
    
public  voidend()
     Marks the start of the bean writing.
protected  voidendElement(WriteContext context, String uri, String localName, String qName)
    
protected  voidendElement(String uri, String localName, String qName)
    
protected  voidexpressAttribute(String qualifiedName, String value)
    
protected  voidexpressAttribute(String namespaceUri, String localName, String qualifiedName, String value)
    
protected  voidexpressBodyText(String text)
    
protected  voidexpressElementEnd(String qualifiedName)
    
protected  voidexpressElementEnd(String uri, String localName, String qualifiedName)
    
protected  voidexpressElementEnd()
     Express an empty element end.
protected  voidexpressElementStart(String qualifiedName)
     Express an element tag start using given qualified name.
protected  voidexpressElementStart(String uri, String localName, String qualifiedName)
     Express an element tag start using given qualified name.
protected  voidexpressTagClose()
     Express a closing tag.
final public  LoggetAbstractBeanWriterLog()
    
public  BindingConfigurationgetBindingConfiguration()
     Gets the dynamic configuration setting to be used for bean reading.
public  IDGeneratorgetIdGenerator()
     Get IDGenerator implementation used to generate ID attribute values .
protected  intgetIndentLevel()
     Get the indentation for the current element.
public  booleangetWriteEmptyElements()
    

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.

public  booleangetWriteIDs()
    
public  XMLIntrospectorgetXMLIntrospector()
    

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.

protected  ObjectpopBean()
    
protected  voidpushBean(Object bean)
     Pushes the bean onto the ancestry stack.
final public  voidsetAbstractBeanWriterLog(Log log)
    

Set the current logging implementation.

public  voidsetBindingConfiguration(BindingConfiguration bindingConfiguration)
     Sets the dynamic configuration setting to be used for bean reading.
public  voidsetIdGenerator(IDGenerator idGenerator)
     Set IDGenerator implementation used to generate ID attribute values.
public  voidsetWriteEmptyElements(boolean writeEmptyElements)
    

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.

public  voidsetWriteIDs(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.
public  voidsetXMLIntrospector(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.

public  voidstart()
     Marks the start of the bean writing.
protected  voidstartElement(WriteContext context, String uri, String localName, String qName, Attributes attr)
     Writes the start tag for an element.
protected  voidstartElement(String uri, String localName, String qName, Attributes attr)
     Writes the start tag for an element.
public  voidwrite(Object bean)
    
public  voidwrite(String qualifiedName, Object bean)
    
public  voidwrite(Object bean, InputSource source)
    

Writes the bean using the mapping specified in the InputSource.

Note: that the custom mapping will not be registered for later use.

protected  voidwrite(String qualifiedName, ElementDescriptor elementDescriptor, Context context)
    
protected  voidwrite(String qualifiedName, ElementDescriptor elementDescriptor, Context context, String idAttribute, String idValue)
    
protected  voidwriteAttribute(AttributeDescriptor attributeDescriptor, Context context)
    
protected  voidwriteAttributes(ElementDescriptor elementDescriptor, Context context)
    
protected  booleanwriteContent(ElementDescriptor elementDescriptor, Context context)
     Writes the element content.
protected  voidwriteIDREFElement(String qualifiedName, String idrefAttributeName, String idrefAttributeValue)
    
protected  voidwriteIndent()
     Writes an indentation.
protected  voidwritePrintln()
     Writes a empty line.
protected  voidwriteRestOfElement(String qualifiedName, ElementDescriptor elementDescriptor, Context context)
    



Method Detail
bodyText
protected void bodyText(WriteContext context, String text) throws IOException, SAXException(Code)
Writes body text
Parameters:
  text - the body text to be written
throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing
since:
   0.5



bodyText
protected void bodyText(String text) throws IOException, SAXException(Code)
Writes body text
Parameters:
  text - the body text to be written
throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing AbstractBeanWriter.bodyText(WriteContext,String)



end
public void end() throws IOException, SAXException(Code)
Marks the start of the bean writing. By default doesn't do anything, but can be used to do extra end processing
throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing



endElement
protected void endElement(WriteContext context, String uri, String localName, String qName) throws IOException, SAXException(Code)
Writes the end tag for an element
Parameters:
  uri - the element's namespace uri
Parameters:
  localName - the element's local name
Parameters:
  qName - the element's qualified name
throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing
since:
   0.5



endElement
protected void endElement(String uri, String localName, String qName) throws IOException, SAXException(Code)
Writes the end tag for an element
Parameters:
  uri - the element's namespace uri
Parameters:
  localName - the element's local name
Parameters:
  qName - the element's qualified name
throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing AbstractBeanWriter.endElement(WriteContext,String,String,String)



expressAttribute
protected void expressAttribute(String qualifiedName, String value) throws IOException, SAXException(Code)
Express an attribute
Parameters:
  qualifiedName - the qualified name of the attribute
Parameters:
  value - the attribute value
throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing



expressAttribute
protected void expressAttribute(String namespaceUri, String localName, String qualifiedName, String value) throws IOException, SAXException(Code)
Express an attribute
Parameters:
  namespaceUri - the namespace uri
Parameters:
  localName - the local name
Parameters:
  qualifiedName - the qualified name of the attribute
Parameters:
  value - the attribute value
throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing



expressBodyText
protected void expressBodyText(String text) throws IOException, SAXException(Code)
Express body text
Parameters:
  text - the string to write out as the body of the current element
throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing



expressElementEnd
protected void expressElementEnd(String qualifiedName) throws IOException, SAXException(Code)
Express an element end tag (with given name)
Parameters:
  qualifiedName - the qualified name for the element to be closed
throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing



expressElementEnd
protected void expressElementEnd(String uri, String localName, String qualifiedName) throws IOException, SAXException(Code)
Express an element end tag (with given name)
Parameters:
  uri - the namespace uri of the element close tag
Parameters:
  localName - the local name of the element close tag
Parameters:
  qualifiedName - the qualified name for the element to be closed
throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing



expressElementEnd
protected void expressElementEnd() throws IOException, SAXException(Code)
Express an empty element end.
throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing



expressElementStart
protected void expressElementStart(String qualifiedName) throws IOException, SAXException(Code)
Express an element tag start using given qualified name.
Parameters:
  qualifiedName - the qualified name of the element to be expressed
throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing



expressElementStart
protected void expressElementStart(String uri, String localName, String qualifiedName) throws IOException, SAXException(Code)
Express an element tag start using given qualified name.
Parameters:
  uri - the namespace uri
Parameters:
  localName - the local name for this element
Parameters:
  qualifiedName - the qualified name of the element to be expressed
throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing



expressTagClose
protected void expressTagClose() throws IOException, SAXException(Code)
Express a closing tag.
throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing



getAbstractBeanWriterLog
final public Log getAbstractBeanWriterLog()(Code)

Gets the current logging implementation.

the Log implementation which this class logs to



getBindingConfiguration
public BindingConfiguration getBindingConfiguration()(Code)
Gets the dynamic configuration setting to be used for bean reading. the BindingConfiguration settings, not null
since:
   0.5



getIdGenerator
public IDGenerator getIdGenerator()(Code)
Get IDGenerator implementation used to generate ID attribute values . implementation used for ID attribute generation



getIndentLevel
protected int getIndentLevel()(Code)
Get the indentation for the current element. Used for pretty priting. the amount that the current element is indented



getWriteEmptyElements
public boolean getWriteEmptyElements()(Code)

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.

true if empty elements will be written into the output
since:
   0.5



getWriteIDs
public boolean getWriteIDs()(Code)

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.

true if ID and IDREF attributes are to be writtenBindingConfiguration.getMapIDs



getXMLIntrospector
public XMLIntrospector getXMLIntrospector()(Code)

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.

the XMLIntrospector used for introspection



popBean
protected Object popBean()(Code)
Pops the top bean off from the ancestry stack the last object pushed onto the ancester stack



pushBean
protected void pushBean(Object bean)(Code)
Pushes the bean onto the ancestry stack. If IDs are not being written, then check for cyclic references.
Parameters:
  bean - push this bean onto the ancester stack



setAbstractBeanWriterLog
final public void setAbstractBeanWriterLog(Log log)(Code)

Set the current logging implementation.


Parameters:
  log - Log implementation to use



setBindingConfiguration
public void setBindingConfiguration(BindingConfiguration bindingConfiguration)(Code)
Sets the dynamic configuration setting to be used for bean reading.
Parameters:
  bindingConfiguration - the BindingConfiguration settings, not null
since:
   0.5



setIdGenerator
public void setIdGenerator(IDGenerator idGenerator)(Code)
Set IDGenerator implementation used to generate ID attribute values. This property can be used to customize the algorithm used for generation.
Parameters:
  idGenerator - use this implementation for ID attribute generation



setWriteEmptyElements
public void setWriteEmptyElements(boolean writeEmptyElements)(Code)

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.
Parameters:
  writeEmptyElements - true if empty elements should be written into the output
since:
   0.5




setWriteIDs
public void setWriteIDs(boolean writeIDs)(Code)
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.
Parameters:
  writeIDs - true if ID's and IDREF's should be writtenBindingConfiguration.setMapIDs



setXMLIntrospector
public void setXMLIntrospector(XMLIntrospector introspector)(Code)

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.


Parameters:
  introspector - use this introspector



start
public void start() throws IOException, SAXException(Code)
Marks the start of the bean writing. By default doesn't do anything, but can be used to do extra start processing
throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing



startElement
protected void startElement(WriteContext context, String uri, String localName, String qName, Attributes attr) throws IOException, SAXException(Code)
Writes the start tag for an element.
Parameters:
  uri - the element's namespace uri
Parameters:
  localName - the element's local name
Parameters:
  qName - the element's qualified name
Parameters:
  attr - the element's attributes
throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing
since:
   0.5



startElement
protected void startElement(String uri, String localName, String qName, Attributes attr) throws IOException, SAXException(Code)
Writes the start tag for an element.
Parameters:
  uri - the element's namespace uri
Parameters:
  localName - the element's local name
Parameters:
  qName - the element's qualified name
Parameters:
  attr - the element's attributes
throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing AbstractBeanWriter.startElement(WriteContext,String,String,String,Attributes)



write
public void write(Object bean) throws IOException, SAXException, IntrospectionException(Code)

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.


throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing
throws:
  IntrospectionException - if a java beans introspection problem occurs
Parameters:
  bean - write out representation of this bean



write
public void write(String qualifiedName, Object bean) throws IOException, SAXException, IntrospectionException(Code)

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.


Parameters:
  qualifiedName - the string naming root element
Parameters:
  bean - the Object to write out as xml
throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing
throws:
  IntrospectionException - if a java beans introspection problem occurs



write
public void write(Object bean, InputSource source) throws IOException, SAXException, IntrospectionException(Code)

Writes the bean using the mapping specified in the InputSource.

Note: that the custom mapping will not be registered for later use. Please use XMLIntrospector.register to register the custom mapping for the class and then call AbstractBeanWriter.write(Object) .


See Also:   AbstractBeanWriter.write(Object)
See Also:    since the standard notes also apply
since:
   0.7
Parameters:
  bean - Object to be written as xml, not null
Parameters:
  source - InputSource/code> containing an xml documentspecifying the mapping to be used (in the usual way), not null
throws:
  IOException -
throws:
  SAXException -
throws:
  IntrospectionException -



write
protected void write(String qualifiedName, ElementDescriptor elementDescriptor, Context context) throws IOException, SAXException, IntrospectionException(Code)
Writes the given element
Parameters:
  qualifiedName - qualified name to use for the element
Parameters:
  elementDescriptor - the ElementDescriptor describing the element
Parameters:
  context - the Context to use to evaluate the bean expressions
throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing
throws:
  IntrospectionException - if a java beans introspection problem occurs



write
protected void write(String qualifiedName, ElementDescriptor elementDescriptor, Context context, String idAttribute, String idValue) throws IOException, SAXException, IntrospectionException(Code)
Writes the given element adding an ID attribute
Parameters:
  qualifiedName - qualified name to use for the element
Parameters:
  elementDescriptor - the ElementDescriptor describing the element
Parameters:
  context - the Context to use to evaluate the bean expressions
Parameters:
  idAttribute - the qualified name of the ID attribute
Parameters:
  idValue - the value for the ID attribute
throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing
throws:
  IntrospectionException - if a java beans introspection problem occurs



writeAttribute
protected void writeAttribute(AttributeDescriptor attributeDescriptor, Context context) throws IOException, SAXException(Code)
Writes an attribute declaration
Parameters:
  attributeDescriptor - the AttributeDescriptor to be written as xml
Parameters:
  context - the Context to use to evaluation bean expressions
throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing



writeAttributes
protected void writeAttributes(ElementDescriptor elementDescriptor, Context context) throws IOException, SAXException(Code)
Writes the attribute declarations
Parameters:
  elementDescriptor - the ElementDescriptor to be written out as xml
Parameters:
  context - the Context to use to evaluation bean expressions
throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing



writeContent
protected boolean writeContent(ElementDescriptor elementDescriptor, Context context) throws IOException, SAXException, IntrospectionException(Code)
Writes the element content.
Parameters:
  elementDescriptor - the ElementDescriptor to write as xml
Parameters:
  context - the Context to use to evaluate the bean expressions true if some content was written
throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing
throws:
  IntrospectionException - if a java beans introspection problem occurs



writeIDREFElement
protected void writeIDREFElement(String qualifiedName, String idrefAttributeName, String idrefAttributeValue) throws IOException, SAXException, IntrospectionException(Code)
Writes an element with a IDREF attribute
Parameters:
  qualifiedName - of the element with IDREF attribute
Parameters:
  idrefAttributeName - the qualified name of the IDREF attribute
Parameters:
  idrefAttributeValue - the value for the IDREF attribute
throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing
throws:
  IntrospectionException - if a java beans introspection problem occurs



writeIndent
protected void writeIndent() throws IOException(Code)
Writes an indentation. This implementation does nothing but can be overridden by subclasses.
throws:
  IOException - if the indent cannot be written



writePrintln
protected void writePrintln() throws IOException(Code)
Writes a empty line. This implementation does nothing but can be overridden by subclasses.
throws:
  IOException - if the line cannot be written



writeRestOfElement
protected void writeRestOfElement(String qualifiedName, ElementDescriptor elementDescriptor, Context context) throws IOException, SAXException, IntrospectionException(Code)
Write attributes, child elements and element end
Parameters:
  qualifiedName - qualified name to use for the element
Parameters:
  elementDescriptor - the ElementDescriptor describing the element
Parameters:
  context - the Context to use to evaluate the bean expressions
throws:
  IOException - if an IO problem occurs during writing
throws:
  SAXException - if an SAX problem occurs during writing
throws:
  IntrospectionException - if a java beans introspection problem occurs



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.