org.strutsme.common.serialization
Class Serializer

java.lang.Object
  extended by org.strutsme.common.serialization.Serializer

public final class Serializer
extends java.lang.Object

The Serializer class transforms an object graph into a string and the other way around. The object graph can consists of the following classes:

Serializer supports cyclic objects graph and also null values.

The SerializerMapper can be used to transform (on the fly) any object into an object of class SerializationBase. This allows to serialize an arbitrary object graph without changing the graph or the classes it consists of.

Version:
$Date$
Author:
rfalke

Method Summary
static java.lang.Object deserialize(java.lang.String s)
          Creates the object graph from the given string.
static java.lang.String serialize(java.lang.Object o)
          Transforms the object graph into a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

deserialize

public static java.lang.Object deserialize(java.lang.String s)
                                    throws SerializationException
Creates the object graph from the given string.

Parameters:
s - the serialized string
Returns:
the object graph
Throws:
SerializationException - if the parameter is malformed, the objects could not be instantiated or in other error cases.

serialize

public static java.lang.String serialize(java.lang.Object o)
                                  throws SerializationException
Transforms the object graph into a string.

Parameters:
o - one node in the object graph which will be used to discover the remaining graph
Returns:
the serialized string
Throws:
SerializationException - if the parameter is malformed, the objects could not be instantiated or in other error cases.