1 package de.timroes.axmlrpc.serializer; 2 3 import de.timroes.axmlrpc.XMLRPCException; 4 import de.timroes.axmlrpc.xmlcreator.XmlElement; 5 import org.w3c.dom.Element; 6 7 /** 8 * A Serializer is responsible to serialize a specific type of data to 9 * an xml tag and deserialize the content of this xml tag back to an object. 10 * 11 * @author Tim Roes 12 */ 13 public interface Serializer { 14 15 /** 16 * This method takes an xml type element and deserialize it to an object. 17 * 18 * @param content Must be an xml element of a specific type. 19 * @return The deserialized content. 20 * @throws XMLRPCException Will be thrown whenervt the deserialization fails. 21 */ deserialize(Element content)22 public Object deserialize(Element content) throws XMLRPCException; 23 24 /** 25 * This method takes an object and returns a representation as a string 26 * containing the right xml type tag. The returning string must be useable 27 * within a value tag. 28 * 29 * @param object The object that should be serialized. 30 * @return An XmlElement representation of the object. 31 */ serialize(Object object)32 public XmlElement serialize(Object object); 33 34 }