org.jfree.report.modules.parser.extwriter
Class ObjectWriter

java.lang.Object
  extended byorg.jfree.xml.writer.XMLWriterSupport
      extended byorg.jfree.report.modules.parser.extwriter.AbstractXMLDefinitionWriter
          extended byorg.jfree.report.modules.parser.extwriter.ObjectWriter
Direct Known Subclasses:
DataSourceWriter, TemplateWriter

public class ObjectWriter
extends AbstractXMLDefinitionWriter

A writer.

Author:
Thomas Morgner.

Field Summary
 
Fields inherited from class org.jfree.xml.writer.XMLWriterSupport
CLOSE, CLOSE_TAG_DECREASE, INDENT_ONLY, OPEN, OPEN_TAG_INCREASE
 
Constructor Summary
ObjectWriter(ReportWriter reportWriter, org.jfree.xml.factory.objects.ObjectDescription objectDescription, int indentLevel, CommentHintPath commentHintPath)
          Creates a new object writer for the given object description.
ObjectWriter(ReportWriter reportWriter, java.lang.Object baseObject, org.jfree.xml.factory.objects.ObjectDescription objectDescription, int indentLevel, CommentHintPath commentHintPath)
          Creates a new writer.
 
Method Summary
 org.jfree.xml.factory.objects.ClassFactoryCollector getClassFactoryCollector()
          Returns the object factory.
 CommentHintPath getCommentHintPath()
          Returns the comment hint path object for this writer.
 org.jfree.xml.factory.objects.ObjectDescription getObjectDescription()
          Returns the object description.
protected  org.jfree.xml.factory.objects.ObjectDescription getParameterDescription(java.lang.String name)
          Returns a description of a parameter.
protected static java.util.ArrayList getParameterNames(org.jfree.xml.factory.objects.ObjectDescription d)
          Returns a list of parameter names.
protected static boolean isBasicObject(java.util.List parameters, org.jfree.xml.factory.objects.ObjectDescription od)
          Returns true if this is a basic object, and false otherwise.
 void write(java.io.Writer writer)
          Writes the description.
protected  void writeParameter(java.io.Writer writer, java.lang.String parameterName)
          Writes a parameter to XML.
 
Methods inherited from class org.jfree.report.modules.parser.extwriter.AbstractXMLDefinitionWriter
getDefaultSafeTags, getReport, getReportWriter, normalize, writeComment, writeComment
 
Methods inherited from class org.jfree.xml.writer.XMLWriterSupport
allowLineBreak, decreaseIndent, endBlock, getIndentLevel, getLineSeparator, getSafeTags, increaseIndent, indent, startBlock, writeCloseTag, writeTag, writeTag, writeTag, writeTag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectWriter

public ObjectWriter(ReportWriter reportWriter,
                    java.lang.Object baseObject,
                    org.jfree.xml.factory.objects.ObjectDescription objectDescription,
                    int indentLevel,
                    CommentHintPath commentHintPath)
             throws ReportWriterException
Creates a new writer.

Parameters:
reportWriter - the report writer.
baseObject - the base object (null not permitted).
objectDescription - the object description (null not permitted) for the to be written object. The base object will be used to fill the object description parameters.
indentLevel - the current indention level.
commentHintPath - the comment hint path used to store additional comments.
Throws:
ReportWriterException - if no writer could be found for the given baseObject.

ObjectWriter

public ObjectWriter(ReportWriter reportWriter,
                    org.jfree.xml.factory.objects.ObjectDescription objectDescription,
                    int indentLevel,
                    CommentHintPath commentHintPath)
Creates a new object writer for the given object description.

Parameters:
reportWriter - the report writer used to write the generated description.
objectDescription - the object description that should be written. It is assumed, that the object description is completly initialized for writing.
indentLevel - the current code indention level
commentHintPath - the comment hint path used to write the comments from the ext-parser.
Method Detail

getObjectDescription

public org.jfree.xml.factory.objects.ObjectDescription getObjectDescription()
Returns the object description.

Returns:
The object description.

getClassFactoryCollector

public org.jfree.xml.factory.objects.ClassFactoryCollector getClassFactoryCollector()
Returns the object factory.

Returns:
The object factory.

write

public void write(java.io.Writer writer)
           throws java.io.IOException,
                  ReportWriterException
Writes the description.

Specified by:
write in class AbstractXMLDefinitionWriter
Parameters:
writer - the writer.
Throws:
java.io.IOException - if there is an I/O problem.
ReportWriterException - if the object could not be written.

getParameterDescription

protected org.jfree.xml.factory.objects.ObjectDescription getParameterDescription(java.lang.String name)
Returns a description of a parameter.

Parameters:
name - the parameter name.
Returns:
The description.

writeParameter

protected void writeParameter(java.io.Writer writer,
                              java.lang.String parameterName)
                       throws java.io.IOException,
                              ReportWriterException
Writes a parameter to XML.

Parameters:
writer - the writer.
parameterName - the parameter name.
Throws:
java.io.IOException - if there is an I/O problem.
ReportWriterException - if transforming the report into a stream failed.

isBasicObject

protected static boolean isBasicObject(java.util.List parameters,
                                       org.jfree.xml.factory.objects.ObjectDescription od)
Returns true if this is a basic object, and false otherwise.

Parameters:
parameters - the parameter.
od - the descriptions.
Returns:
A boolean.

getParameterNames

protected static java.util.ArrayList getParameterNames(org.jfree.xml.factory.objects.ObjectDescription d)
Returns a list of parameter names.

Parameters:
d - the description.
Returns:
The list.

getCommentHintPath

public CommentHintPath getCommentHintPath()
Returns the comment hint path object for this writer. This path is used to store comments found in the xml code.

Returns:
the comment hint path object for this writer.