org.spicefactory.cinnamon.io.xml
Interface XmlAdapter

All Known Implementing Classes:
Dom4jXmlAdapter, W3cXmlAdapter, XomXmlAdapter

public interface XmlAdapter

Implementations of this interface are responsible for creating XML DOM instances from String values and vice versa. With this interface you can plug your preferred XML DOM API into Cinnamons AMF3 encoding/decoding process. Cinnamon contains three builtin adapters for W3C DOM, dom4j and XOM.

Author:
Jens Halm

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.
 

Method Detail

init

void init()
Initializes the adapter, called once for each instance at application startup.


buildDocument

Object buildDocument(String xml)
Builds an XML DOM instance from the given string.

Parameters:
xml - the XML document as a string
Returns:
a DOM instance

isXmlDocumentClass

boolean isXmlDocumentClass(Class<?> type)
Checks whether the given class represents an XML DOM class that this adapter can process.

Parameters:
type - the class to check
Returns:
true if the given object represents an XML DOM instance that this adapter can process

toXmlString

String toXmlString(Object object)
Returns the String representation for the given DOM instance.

Parameters:
object - the DOM instance
Returns:
the String representation for the given DOM instance