Java Doc for KBMLSerializer.java in  » XML » KBML » fr » dyade » koala » xml » kbml » 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 » XML » KBML » fr.dyade.koala.xml.kbml 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   fr.dyade.koala.xml.kbml.KBMLSerializer

All known Subclasses:   fr.dyade.koala.xml.kbml.KBMLSerializerDefaultErrorHandler,
KBMLSerializer
public class KBMLSerializer (Code)
The class enables to create an XML document from JavaBeans. Any number of beans can be written. In order to have a valid XML document, the beans must be enclosed by the KBML tag. Here is an exemple to write 2 beans:

 KBMLSerializer bxo = new KBMLSerializer(new FileOutputStream("test.kbml"));
 bxo.writeXMLDeclaration();
 bxo.writeDocumentTypeDefinition();
 bxo.writeKBMLStartTag();
 bxo.writeBean(bean1);
 bxo.writeBean(bean2);
 bxo.writeKBMLEndTag();
 bxo.flush();
 bxo.close();
 

author:
   Thierry.Kormann@sophia.inria.fr

Inner Class :public interface ErrorHandler

Field Summary
final static  StringCOPYRIGHT
     The KBML copyright.
final static  StringDOCTYPE
    
final static  StringEND_ROOT_ELEMENT
    
static  StringID_PREFIX
    
final static  StringSTART_ROOT_ELEMENT
    
final public static  StringVERSION
     The KBML version.
final public static  intWRITE_DEFAULT_VALUES
     This flag bit indicates that the default values must be written.
final static  StringXML_DECLARATION
    
protected  HashtablebeansCache
     The Hashtable where keys are Object and values are ID.
protected  ErrorHandlerhandler
     The error handler used to notify no-fatal errors.
protected  OutputStreamostream
     The underlying output stream used to store the beans.
protected  intserializationOptions
     The options used by this serializer.
protected  Writerwriter
     The underlying writer used to store the beans.

Constructor Summary
public  KBMLSerializer(OutputStream ostream)
     Constructs a new serializer with the specified output stream.
public  KBMLSerializer(OutputStream ostream, ErrorHandler handler)
     Constructs a new serializer with the specified output stream and error handler.
public  KBMLSerializer(Writer writer)
     Constructs a new serializer with the specified writer.
public  KBMLSerializer(Writer writer, ErrorHandler handler)
     Constructs a new serializer with the specified writer and error handler.

Method Summary
public  voidclose()
     Closes the output stream.
public  voidflush()
     Flushes the output stream.
protected  StringgetBeanClassName(Object bean)
     Returns the class attribute that will be written in the XML document for the given bean.
public  HashtablegetBeansCache()
     Returns the internal cache used by the serializer.
protected  voidinitializePropertyEditorManager()
     Initializes the PropertyEditorManager with some new PropertyEditors.
 StringnewID()
    
public  voidsetSerializationOptions(int serializationOptions)
     Enables or disables options that can modify the way this serializer writes beans, properties and values.
 voidwrite(String s)
    
public  voidwriteBean(Object bean)
     Writes the specified bean object.
 voidwriteBeanEndElement()
    
 voidwriteBeanRefElement(String id)
    
 voidwriteBeanStartElement(String className, String id)
    
public  voidwriteComment(String comment)
     Writes a comment.
Parameters:
  comment - The comment string.
 voidwriteContent(String s)
    
public  voidwriteDocumentTypeDefinition()
     Writes the default document type definition.
public  voidwriteDocumentTypeDefinition(String doctype)
     Writes the specified document type definition.
public  voidwriteKBMLEndTag()
     Writes the KBML end tag.
public  voidwriteKBMLStartTag()
     Writes the KBML start tag.
 voidwriteNullElement()
    
 voidwritePropertyEndElement()
    
 voidwritePropertyStartElement(String name)
    
 voidwriteValue(PropertyDescriptor pd, Object value, Class expectedClass)
    
 voidwriteValueArrayEndElement()
    
 voidwriteValueArrayRefElement(String id)
    
 voidwriteValueArrayStartElement(String id)
    
 voidwriteValueEndElement()
    
 voidwriteValueRefElement(String id)
    
 voidwriteValueStartElement()
    
 voidwriteValueStartElement(String id)
    
 voidwriteValueStartElement(Class _class, String id)
    
public  voidwriteXMLDeclaration()
     Writes the XML declaration.

Field Detail
COPYRIGHT
final static String COPYRIGHT(Code)
The KBML copyright.



DOCTYPE
final static String DOCTYPE(Code)



END_ROOT_ELEMENT
final static String END_ROOT_ELEMENT(Code)



ID_PREFIX
static String ID_PREFIX(Code)
The prefix used to generate id



START_ROOT_ELEMENT
final static String START_ROOT_ELEMENT(Code)



VERSION
final public static String VERSION(Code)
The KBML version.



WRITE_DEFAULT_VALUES
final public static int WRITE_DEFAULT_VALUES(Code)
This flag bit indicates that the default values must be written.



XML_DECLARATION
final static String XML_DECLARATION(Code)



beansCache
protected Hashtable beansCache(Code)
The Hashtable where keys are Object and values are ID.



handler
protected ErrorHandler handler(Code)
The error handler used to notify no-fatal errors.



ostream
protected OutputStream ostream(Code)
The underlying output stream used to store the beans.



serializationOptions
protected int serializationOptions(Code)
The options used by this serializer.



writer
protected Writer writer(Code)
The underlying writer used to store the beans.




Constructor Detail
KBMLSerializer
public KBMLSerializer(OutputStream ostream)(Code)
Constructs a new serializer with the specified output stream.
Parameters:
  ostream - the underlying output stream, to be saved for later use



KBMLSerializer
public KBMLSerializer(OutputStream ostream, ErrorHandler handler)(Code)
Constructs a new serializer with the specified output stream and error handler.
Parameters:
  ostream - the underlying output stream, to be saved for later use
Parameters:
  handler - the handler to track the no-fatal error



KBMLSerializer
public KBMLSerializer(Writer writer)(Code)
Constructs a new serializer with the specified writer.
Parameters:
  writer - the underlying writer, to be saved for later use



KBMLSerializer
public KBMLSerializer(Writer writer, ErrorHandler handler)(Code)
Constructs a new serializer with the specified writer and error handler.
Parameters:
  writer - the underlying writer, to be saved for later use
Parameters:
  handler - the handler to track the no-fatal error




Method Detail
close
public void close() throws IOException(Code)
Closes the output stream.
exception:
  IOException - if an I/O error occurs.
exception:
  IllegalStateException - if KBML tag is opened and not closed.



flush
public void flush() throws IOException(Code)
Flushes the output stream.
exception:
  IOException - if an I/O error occurs



getBeanClassName
protected String getBeanClassName(Object bean)(Code)
Returns the class attribute that will be written in the XML document for the given bean. Override to let custom a class loader returns a coded class name (like an URL).
Parameters:
  bean - the bean the string representation of the specified bean class
since:
   KBML 2.2



getBeansCache
public Hashtable getBeansCache()(Code)
Returns the internal cache used by the serializer. Use the bean as a key to get its associated ID.



initializePropertyEditorManager
protected void initializePropertyEditorManager()(Code)
Initializes the PropertyEditorManager with some new PropertyEditors.
See Also:   Util.initializePropertyEditorManager



newID
String newID()(Code)



setSerializationOptions
public void setSerializationOptions(int serializationOptions)(Code)
Enables or disables options that can modify the way this serializer writes beans, properties and values.
Parameters:
  serializationOptions - determines how this serializer willwrite beans, properties or values
See Also:   KBMLSerializer.WRITE_DEFAULT_VALUES
since:
   KBML 2.3



write
void write(String s) throws IOException(Code)



writeBean
public void writeBean(Object bean) throws IOException(Code)
Writes the specified bean object.
Parameters:
  bean - the bean object to write
exception:
  IOException - if an I/O error occurs
exception:
  IllegalStateException - if not inside the KBML tag.



writeBeanEndElement
void writeBeanEndElement() throws IOException(Code)



writeBeanRefElement
void writeBeanRefElement(String id) throws IOException(Code)



writeBeanStartElement
void writeBeanStartElement(String className, String id) throws IOException(Code)



writeComment
public void writeComment(String comment) throws IOException(Code)
Writes a comment.
Parameters:
  comment - The comment string. Special characters will be quoted.
exception:
  IOException - if an I/O error occurs



writeContent
void writeContent(String s) throws IOException(Code)



writeDocumentTypeDefinition
public void writeDocumentTypeDefinition() throws IOException(Code)
Writes the default document type definition. The DTD used is the one located at http://www.inria.fr/koala/kbml/kbml20.dtd
exception:
  IOException - if an I/O error occurs
since:
   KBML 2.2



writeDocumentTypeDefinition
public void writeDocumentTypeDefinition(String doctype) throws IOException(Code)
Writes the specified document type definition.
Parameters:
  doctype - the document type definition to write
exception:
  IOException - if an I/O error occurs
since:
   KBML 2.2



writeKBMLEndTag
public void writeKBMLEndTag() throws IOException(Code)
Writes the KBML end tag.
exception:
  IOException - if an I/O error occurs
exception:
  IllegalStateException - if KBML start tag was notwritten, or KBML end tag was already written.



writeKBMLStartTag
public void writeKBMLStartTag() throws IOException(Code)
Writes the KBML start tag.
exception:
  IOException - if an I/O error occurs
exception:
  IllegalStateException - if KBML start tag was already written.



writeNullElement
void writeNullElement() throws IOException(Code)



writePropertyEndElement
void writePropertyEndElement() throws IOException(Code)



writePropertyStartElement
void writePropertyStartElement(String name) throws IOException(Code)



writeValue
void writeValue(PropertyDescriptor pd, Object value, Class expectedClass) throws IOException(Code)



writeValueArrayEndElement
void writeValueArrayEndElement() throws IOException(Code)



writeValueArrayRefElement
void writeValueArrayRefElement(String id) throws IOException(Code)



writeValueArrayStartElement
void writeValueArrayStartElement(String id) throws IOException(Code)



writeValueEndElement
void writeValueEndElement() throws IOException(Code)



writeValueRefElement
void writeValueRefElement(String id) throws IOException(Code)



writeValueStartElement
void writeValueStartElement() throws IOException(Code)



writeValueStartElement
void writeValueStartElement(String id) throws IOException(Code)



writeValueStartElement
void writeValueStartElement(Class _class, String id) throws IOException(Code)



writeXMLDeclaration
public void writeXMLDeclaration() throws IOException(Code)
Writes the XML declaration. The declaration is <?xml version='1.0' encoding='UTF-8'?>
exception:
  IOException - if an I/O error occurs
since:
   KBML 2.2



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.