eneter.messaging.dataprocessing.serializing
Class XmlStringSerializer

java.lang.Object
  extended by eneter.messaging.dataprocessing.serializing.XmlStringSerializer
All Implemented Interfaces:
ISerializer

public class XmlStringSerializer
extends java.lang.Object
implements ISerializer

Serializes data to XML which is compatible with .NET. This is the default serializer used by the framework. The serializer is compatible with XmlStringSerializer from Eneter Messaging Framework for .NET. Therefore, you can use it for the communication between Java and .NET applications. The serializer does not support generic types on Java and Android platforms!


Constructor Summary
XmlStringSerializer()
           
 
Method Summary
<T> T
deserialize(java.lang.Object serializedData, java.lang.Class<T> clazz)
          Deserializes data into the specified type.
<T> java.lang.Object
serialize(T dataToSerialize, java.lang.Class<T> clazz)
          Serializes data to the xml string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlStringSerializer

public XmlStringSerializer()
Method Detail

serialize

public <T> java.lang.Object serialize(T dataToSerialize,
                                      java.lang.Class<T> clazz)
                           throws java.lang.Exception
Serializes data to the xml string.

Specified by:
serialize in interface ISerializer
Parameters:
dataToSerialize - Data to be serialized.
clazz - represents the serialized type.
Returns:
Object representing the serialized data. Based on the serializer implementation it can be byte[] or String.
Throws:
java.lang.Exception - If the serialization fails.

deserialize

public <T> T deserialize(java.lang.Object serializedData,
                         java.lang.Class<T> clazz)
              throws java.lang.Exception
Deserializes data into the specified type.

Specified by:
deserialize in interface ISerializer
Parameters:
serializedData - Data to be deserialized.
Returns:
Deserialized object.
Throws:
java.lang.Exception - If the deserialization fails.