net.sf.daileon.xml
Interface XmlHandler

All Known Implementing Classes:
JaxbXmlHandler

public interface XmlHandler

The XmlHandler interface defines methods for serializing objects to a particular OutputStream, as well as reading XML files and returning objects equivalent to their structure.

Version:
01/01/2010
Author:
Roberto Perillo

Method Summary
 void beanToXml(Object bean, OutputStream destiny, String context)
          Serializes the content of a given object to an OutputStream.
 Object xmlToBean(InputStream source, String context)
          Retrieves the content of a given XML file as an Object.
 

Method Detail

beanToXml

void beanToXml(Object bean,
               OutputStream destiny,
               String context)
               throws XmlHandlerException
Serializes the content of a given object to an OutputStream.

Parameters:
bean - The object to be serialized in form of XML file.
destiny - The destination (as OutputStream) of the XML file to be serialized.
context - The context of the XML file. For instance, for the JaxbXmlHandler implementation, the context is the package where the objects that represent the XML structure are located.
Throws:
XmlHandlerException - If any problem occur when trying to serialize the object.

xmlToBean

Object xmlToBean(InputStream source,
                 String context)
                 throws XmlHandlerException
Retrieves the content of a given XML file as an Object.

Parameters:
source - The XML file to be read, as InputStream.
context - The context of the XML file. For instance, for the JaxbXmlHandler implementation, the context is the package where the objects that represent the XML structure are located.
Returns:
The structure of the XML file as an Object.
Throws:
XmlHandlerException - If any problem occur when trying to read the XML file and transform it to an Object representation.