org.spicefactory.cinnamon.io.xml
Class Dom4jXmlAdapter

java.lang.Object
  extended by org.spicefactory.cinnamon.io.xml.Dom4jXmlAdapter
All Implemented Interfaces:
XmlAdapter

public class Dom4jXmlAdapter
extends Object
implements XmlAdapter

XmlAdapter implementation that converts Strings to/from dom4j document instances.

Author:
Jens Halm

Constructor Summary
Dom4jXmlAdapter()
           
 
Method Summary
 Object buildDocument(String xml)
          Builds an XML DOM instance from the given string.
 void init()
          Initializes the adapter, called once for each instance at application startup.
 boolean isXmlDocumentClass(Class<?> type)
          Checks whether the given class represents an XML DOM class that this adapter can process.
 String toXmlString(Object object)
          Returns the String representation for the given DOM instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Dom4jXmlAdapter

public Dom4jXmlAdapter()
Method Detail

init

public void init()
Description copied from interface: XmlAdapter
Initializes the adapter, called once for each instance at application startup.

Specified by:
init in interface XmlAdapter

buildDocument

public Object buildDocument(String xml)
Description copied from interface: XmlAdapter
Builds an XML DOM instance from the given string.

Specified by:
buildDocument in interface XmlAdapter
Parameters:
xml - the XML document as a string
Returns:
a DOM instance

isXmlDocumentClass

public boolean isXmlDocumentClass(Class<?> type)
Description copied from interface: XmlAdapter
Checks whether the given class represents an XML DOM class that this adapter can process.

Specified by:
isXmlDocumentClass in interface XmlAdapter
Parameters:
type - the class to check
Returns:
true if the given object represents an XML DOM instance that this adapter can process

toXmlString

public String toXmlString(Object object)
Description copied from interface: XmlAdapter
Returns the String representation for the given DOM instance.

Specified by:
toXmlString in interface XmlAdapter
Parameters:
object - the DOM instance
Returns:
the String representation for the given DOM instance