marquee.xmlrpc.objectcomm
Class Serializer

java.lang.Object
  extended bymarquee.xmlrpc.objectcomm.Serializer
All Implemented Interfaces:
XmlRpcCustomSerializer

public class Serializer
extends java.lang.Object
implements XmlRpcCustomSerializer

This XmlRpcCustomSerializer serializes any Java object as an Xml-Rpc struct with a special member named "#ClassName". This member contains the qualified classname of the serialized type plus an object identifier which is used to track objects which have already been serialized for this serialization process.

The format of the member is "qualified.class.name.of.Type,oid" where oid is an integer number identifying the object being serialized. The serializer continues to serialize the content of the object if and only if the object being serialized has not already been serialized in this serialization process. That means that the content of an object is only serialized once, following references to the same object consist only of the "#ClassName" member with the same object identifier as the first occurence.

Since:
JDK 1.3
Version:
$Revision: 1.2 $
Author:
Rainer Bischof
See Also:
XmlRpcCustomSerializer

Constructor Summary
Serializer()
           
 
Method Summary
 java.lang.Class getSupportedClass()
          Returns the class of java.lang.Object as this serializer may serialze any object
 void serialize(java.lang.Object value, java.lang.StringBuffer output)
          Serializes value to output.
static void setRequireSerializeable(boolean requireSerializeable)
          Sets if the Serilizer should require transferred objects to implement java.io.Serializable.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Serializer

public Serializer()
Method Detail

getSupportedClass

public java.lang.Class getSupportedClass()
Returns the class of java.lang.Object as this serializer may serialze any object

Specified by:
getSupportedClass in interface XmlRpcCustomSerializer
Returns:
The class of objects interpretable to this serializer.

setRequireSerializeable

public static void setRequireSerializeable(boolean requireSerializeable)
Sets if the Serilizer should require transferred objects to implement java.io.Serializable.


serialize

public void serialize(java.lang.Object value,
                      java.lang.StringBuffer output)
               throws XmlRpcException
Serializes value to output.

Specified by:
serialize in interface XmlRpcCustomSerializer
Parameters:
value - The object to serialize.
output - The buffer to place the serialized data.
Throws:
XmlRpcException - in case anything goes wrong during serializing.