org.hydrateframework
Class XMLDocWriterParser.TestOutputHandler

java.lang.Object
  extended by org.hydrateframework.XMLDocWriterParser.TestOutputHandler
All Implemented Interfaces:
XMLDocWriterParser.TestOutput
Enclosing class:
XMLDocWriterParser

public static class XMLDocWriterParser.TestOutputHandler
extends java.lang.Object
implements XMLDocWriterParser.TestOutput

This implementation of the TestOutput interface provides a default implementation for each of its methods. The default implementation in effect does nothing and passing an instance of this class as the TestOutput is the equivalent of passing in null, however by deriving from this class instead of implementing the base interface, you will only have to override the one or two methods you need to have your desired effect.


Constructor Summary
XMLDocWriterParser.TestOutputHandler()
           
 
Method Summary
 void afterAttributes(org.xml.sax.ContentHandler hnd, java.lang.Object o, java.lang.String xPath)
          This method is called after the attributes of an object have been written but before the object element is closed.
 void afterObject(org.xml.sax.ContentHandler hnd, java.lang.Object o, java.lang.String xPath)
          This method is called after an object has been written.
 java.lang.String[] beforeAttributes(org.xml.sax.ContentHandler hnd, java.lang.Object o, java.lang.String xPath, java.lang.String[] exclude)
          This method is called after the object element has been written, but before any of its attributes or sub-objects have been written.
 org.xml.sax.Attributes beforeObject(org.xml.sax.ContentHandler hnd, java.lang.Object o, java.lang.String xPath, org.xml.sax.Attributes attrs)
          This method is called just before an object is to be written to the SAX stream.
 java.util.Comparator getComparator(java.lang.String xPath)
          This method is called before writing out a collection of objects to determine the order they should be written in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLDocWriterParser.TestOutputHandler

public XMLDocWriterParser.TestOutputHandler()
Method Detail

getComparator

public java.util.Comparator getComparator(java.lang.String xPath)
Description copied from interface: XMLDocWriterParser.TestOutput
This method is called before writing out a collection of objects to determine the order they should be written in.

Specified by:
getComparator in interface XMLDocWriterParser.TestOutput
Parameters:
xPath - the X-Path (see http://www.w3.org/TR/xpath) that indicates where we are in the object hierarchy. The final element of this path is the name of the object instance that is to be sorted.
Returns:
a comparator that can be used to order objects of the given type. Return null if the objects should not be sorted

beforeObject

public org.xml.sax.Attributes beforeObject(org.xml.sax.ContentHandler hnd,
                                           java.lang.Object o,
                                           java.lang.String xPath,
                                           org.xml.sax.Attributes attrs)
Description copied from interface: XMLDocWriterParser.TestOutput
This method is called just before an object is to be written to the SAX stream.

Specified by:
beforeObject in interface XMLDocWriterParser.TestOutput
Parameters:
hnd - the content handler that is being used to write out the SAX stream. Use this if you want to write anything out before the object is written.
o - the hydrate object that is about to be written.
xPath - the X-Path (see http://www.w3.org/TR/xpath) that represents the location of the object in the XML tree.
attrs - the attributes that are about to be written as part of the object element.
Returns:
the attributes that should be written as part of the object element or null. You can do one of the following
  1. Return the attrs value as is to just write the object normally.
  2. Create a new, modified version of attrs, to remove, modify or append attributes.
  3. return null to prevent the object from being written at all.

beforeAttributes

public java.lang.String[] beforeAttributes(org.xml.sax.ContentHandler hnd,
                                           java.lang.Object o,
                                           java.lang.String xPath,
                                           java.lang.String[] exclude)
Description copied from interface: XMLDocWriterParser.TestOutput
This method is called after the object element has been written, but before any of its attributes or sub-objects have been written.

Specified by:
beforeAttributes in interface XMLDocWriterParser.TestOutput
Parameters:
hnd - the content handler that is being used to write out the SAX stream. Use this if you want to write anything out before the object is written.
o - the hydrate object whose attributes are about to be written.
xPath - the X-Path (see http://www.w3.org/TR/xpath) that represents the location of the object in the XML tree.
exclude - the list of attribute names that will be excluded from the output. By default, this includes those attributes that form part of the key, but this list can be modified by implementations of this interface.
Returns:
the list of attribute names that should be excluded from the output file. You can do one of the following
  1. Return the exclude value as is to just write the object normally.
  2. Create a new, modified version of exclude, to remove, modify or append attributes.
  3. return null to prevent the object attributes (including sub-objects) from being written at all.

afterAttributes

public void afterAttributes(org.xml.sax.ContentHandler hnd,
                            java.lang.Object o,
                            java.lang.String xPath)
Description copied from interface: XMLDocWriterParser.TestOutput
This method is called after the attributes of an object have been written but before the object element is closed.

Specified by:
afterAttributes in interface XMLDocWriterParser.TestOutput
Parameters:
hnd - the content handler that is being used to write out the SAX stream. Use this if you want to write anything out before the object is written.
o - the hydrate object whose attributes are about to be written.
xPath - the X-Path (see http://www.w3.org/TR/xpath) that represents the location of the object in the XML tree.

afterObject

public void afterObject(org.xml.sax.ContentHandler hnd,
                        java.lang.Object o,
                        java.lang.String xPath)
Description copied from interface: XMLDocWriterParser.TestOutput
This method is called after an object has been written.

Specified by:
afterObject in interface XMLDocWriterParser.TestOutput
Parameters:
hnd - the content handler that is being used to write out the SAX stream. Use this if you want to write anything out before the object is written.
o - the hydrate object whose attributes are about to be written.
xPath - the X-Path (see http://www.w3.org/TR/xpath) that represents the location of the object in the XML tree.


Copyright © 2000 The Hydrate Project. All Rights Reserved.