org.jfree.report.modules.parser.ext
Class BasicObjectHandler

java.lang.Object
  extended byorg.jfree.report.modules.parser.ext.AbstractExtReportParserHandler
      extended byorg.jfree.report.modules.parser.ext.BasicObjectHandler
All Implemented Interfaces:
org.jfree.xml.ElementDefinitionHandler
Direct Known Subclasses:
CompoundObjectHandler

public class BasicObjectHandler
extends AbstractExtReportParserHandler

A basic object handler. Basic objects simplify the description of simple data types, like Float, String, Integer etc..

Simple data types only have one string property, which is called "value". The property value is parsed by the ObjectDescription object to create the object.

Author:
Thomas Morgner.

Constructor Summary
BasicObjectHandler(ReportParser parser, java.lang.String finishTag, java.lang.Class targetObject, CommentHintPath commentHintPath)
          Creates a new handler.
BasicObjectHandler(ReportParser parser, java.lang.String finishTag, org.jfree.xml.factory.objects.ObjectDescription od, CommentHintPath commentHintPath)
          Creates a new handler.
 
Method Summary
 void characters(char[] ch, int start, int length)
          Callback to indicate that some character data has been read.
protected  CommentHintPath createCommentKey(java.lang.Object name)
          Creates a new comment hint path for the given name by appending it to a copy of the current path.
 void endElement(java.lang.String tagName)
          Callback to indicate that an XML element end tag has been read by the parser.
protected  CommentHintPath getCommentKey()
          Returns the comment hint path used in this factory.
protected  org.jfree.xml.factory.objects.ObjectDescription getTargetObjectDescription()
          Returns the target object description.
 java.lang.Object getValue()
          Returns the object created by the handler.
 void startElement(java.lang.String tagName, org.xml.sax.Attributes attrs)
          Callback to indicate that an XML element start tag has been read by the parser.
 
Methods inherited from class org.jfree.report.modules.parser.ext.AbstractExtReportParserHandler
addComment, getFinishTag, getParser, getParserHints, getReport, getReportParser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicObjectHandler

public BasicObjectHandler(ReportParser parser,
                          java.lang.String finishTag,
                          org.jfree.xml.factory.objects.ObjectDescription od,
                          CommentHintPath commentHintPath)
Creates a new handler.

Parameters:
parser - the parser.
finishTag - the finish tag.
od - the object description of the target object.
commentHintPath - the path on where to search for ext-parser comments in the report builder hints.

BasicObjectHandler

public BasicObjectHandler(ReportParser parser,
                          java.lang.String finishTag,
                          java.lang.Class targetObject,
                          CommentHintPath commentHintPath)
                   throws org.xml.sax.SAXException
Creates a new handler.

Parameters:
parser - the parser.
finishTag - the finish tag.
targetObject - the object type that should be created by this handler.
commentHintPath - the path on where to search for ext-parser comments in the report builder hints.
Throws:
org.xml.sax.SAXException - if a parser error occurs.
Method Detail

startElement

public void startElement(java.lang.String tagName,
                         org.xml.sax.Attributes attrs)
                  throws org.xml.sax.SAXException
Callback to indicate that an XML element start tag has been read by the parser.

Parameters:
tagName - the tag name.
attrs - the attributes.
Throws:
org.xml.sax.SAXException - as the basic object tag has no child elements.

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Callback to indicate that some character data has been read.

Parameters:
ch - the character array.
start - the start index for the characters.
length - the length of the character sequence.
Throws:
org.xml.sax.SAXException - if an parser error occurs.

endElement

public void endElement(java.lang.String tagName)
                throws org.xml.sax.SAXException
Callback to indicate that an XML element end tag has been read by the parser.

Parameters:
tagName - the tag name.
Throws:
org.xml.sax.SAXException - if a parser error occurs or the validation failed.

getValue

public java.lang.Object getValue()
Returns the object created by the handler.

Returns:
The object.

getTargetObjectDescription

protected org.jfree.xml.factory.objects.ObjectDescription getTargetObjectDescription()
Returns the target object description.

Returns:
The object description.

getCommentKey

protected CommentHintPath getCommentKey()
Returns the comment hint path used in this factory. This path is used to mark the parse position in the report builder hints.

Returns:
the comment hint path.

createCommentKey

protected CommentHintPath createCommentKey(java.lang.Object name)
Creates a new comment hint path for the given name by appending it to a copy of the current path.

Parameters:
name - the name of the new path segment.
Returns:
the new comment path.