com.commsen.jwebthumb.simplexml
Class SimpleXmlSerializer

java.lang.Object
  extended by com.commsen.jwebthumb.simplexml.SimpleXmlSerializer

public class SimpleXmlSerializer
extends java.lang.Object

Utility class responsible for converting objects to XML and XMLs to Objects. The class relies on Simple XML serialization project

Since:
0.3
Author:
Milen Dyankov

Constructor Summary
SimpleXmlSerializer()
           
 
Method Summary
static java.lang.String generateRequest(java.lang.Object object)
          Converts property annotated object to XML
static void generateRequest(java.lang.Object object, java.io.OutputStream outputStream)
          Converts property annotated object to XML and writes it to given stream
static
<T> T
parseResponse(java.io.InputStream inputStream, java.lang.Class<T> clazz)
          Converts XML stream to appropriate object based on objects' annotations
static
<T> T
parseResponse(java.lang.String xml, java.lang.Class<T> clazz)
          Converts XML to appropriate object based on objects' annotations
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleXmlSerializer

public SimpleXmlSerializer()
Method Detail

generateRequest

public static java.lang.String generateRequest(java.lang.Object object)
Converts property annotated object to XML

Parameters:
object - property annotated object
Returns:
XML representation of the object

generateRequest

public static void generateRequest(java.lang.Object object,
                                   java.io.OutputStream outputStream)
Converts property annotated object to XML and writes it to given stream

Parameters:
object - property annotated object
outputStream - the stream to write the XML to

parseResponse

public static <T> T parseResponse(java.lang.String xml,
                                  java.lang.Class<T> clazz)
Converts XML to appropriate object based on objects' annotations

Type Parameters:
T -
Parameters:
xml - string containing the XML to be converted to object
clazz - the type of the return object
Returns:

parseResponse

public static <T> T parseResponse(java.io.InputStream inputStream,
                                  java.lang.Class<T> clazz)
Converts XML stream to appropriate object based on objects' annotations

Type Parameters:
T -
Parameters:
inputStream - the stream to read the XML from
clazz - the type of the return object
Returns:


Copyright © 2010 COMMSEN International. All Rights Reserved.