Joda System API

org.joda.property.xml.impl
Class BeanXMLConvertor

java.lang.Object
  |
  +--org.joda.property.xml.impl.BeanXMLConvertor
All Implemented Interfaces:
XMLConvertor

public class BeanXMLConvertor
extends java.lang.Object
implements XMLConvertor

BeanXMLConvertor converts a bean to and from XMLData. As properties can affect the bean's XMLData, this convertor calls the XMLConvertor for each property in turn.

Author:
Stephen Colebourne

Field Summary
static XMLConvertor INSTANCE
           
 
Constructor Summary
protected BeanXMLConvertor()
          Restrictive constructor
 
Method Summary
 void buildPropertiesXMLData(XMLConvertorContext context, XMLData data, Bean bean)
          Build the XMLData for the properties.
 void buildXMLData(XMLConvertorContext context, XMLData parent, java.lang.Object object)
          Build the XMLData representation of the bean passed in.
 void expandXMLData(XMLConvertorContext context, XMLData data)
          Build the XMLData for a bean.
 boolean isConvertorFor(java.lang.Object object)
          Check to see if this convertor handles the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final XMLConvertor INSTANCE
Constructor Detail

BeanXMLConvertor

protected BeanXMLConvertor()
Restrictive constructor

Method Detail

isConvertorFor

public boolean isConvertorFor(java.lang.Object object)
Description copied from interface: XMLConvertor
Check to see if this convertor handles the object.

Specified by:
isConvertorFor in interface XMLConvertor
Parameters:
object - the object to check
Returns:
true if convertor handles object
See Also:
XMLConvertor.isConvertorFor(Object)

expandXMLData

public void expandXMLData(XMLConvertorContext context,
                          XMLData data)
Build the XMLData for a bean. This must use the context to avoid infinite recursion and take appropriate action. It must also get the XMLData for the properties, as they can impact the XMLData of the bean (such as properties being set as attributes on the bean's element).

Specified by:
expandXMLData in interface XMLConvertor
Parameters:
context - the XML context
data - the bean's XMLData to update

buildPropertiesXMLData

public void buildPropertiesXMLData(XMLConvertorContext context,
                                   XMLData data,
                                   Bean bean)
Build the XMLData for the properties. This loops through each property in turn asking it to add its data to the XMLData passed in. Note that the XMLData is the bean's XMLData.


buildXMLData

public void buildXMLData(XMLConvertorContext context,
                         XMLData parent,
                         java.lang.Object object)
Build the XMLData representation of the bean passed in.

Specified by:
buildXMLData in interface XMLConvertor
Parameters:
context - the context for the output
parent - the parent XMLData to add to
object - the object to convert

Joda System API

Copyright © 2001-2003 Stephen Colebourne. All Rights Reserved.