com.echomine.xmlrpc
Class SerializerFactory

java.lang.Object
  extended by com.echomine.xmlrpc.SerializerFactory

public class SerializerFactory
extends java.lang.Object

The main factory that will check to look up what serializer/deserializer to use to work with the current object.


Constructor Summary
SerializerFactory()
           
 
Method Summary
 void addDeserializer(java.lang.String name, Deserializer deserializer)
          registers a deserializer for the particular name type.
 void addSerializer(java.lang.Class classType, Serializer serializer)
          registers a serializer for a particular class type.
 java.lang.Object deserialize(Element elem)
           
protected  void init()
           
protected  void initArray()
          initializes the serializer/deserializer for the given type
protected  void initBase64()
          initializes the serializer/deserializer for the given type
protected  void initBoolean()
          initializes the serializer/deserializer for the given type
protected  void initDate()
          initializes the serializer/deserializer for the given type
protected  void initDouble()
          initializes the serializer/deserializer for the given type
protected  void initInt()
          initializes the serializer/deserializer for the given type
protected  void initString()
          initializes the serializer/deserializer for the given type
protected  void initStruct()
          initializes the serializer/deserializer for the given type
 boolean isDeserializerRegisteredFor(java.lang.String name)
          checks to see if there is a deserializer registered for the given name type
 boolean isSerializerRegisteredFor(java.lang.Class classType)
          checks to see if there is a serializer registered for the given class type
 Element serialize(java.lang.Object object, Namespace ns)
           
 void setTimeZone(java.util.TimeZone tz)
          sets the timezone to serialize the date/time to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerializerFactory

public SerializerFactory()
Method Detail

serialize

public Element serialize(java.lang.Object object,
                         Namespace ns)
Returns:
the Element object of the serialized data, null if there were any problems

deserialize

public java.lang.Object deserialize(Element elem)
Returns:
the deserialized object or null if there were no deserializer for the element type

setTimeZone

public void setTimeZone(java.util.TimeZone tz)
sets the timezone to serialize the date/time to. Whatever date object you pass in, no matter what time zone it is in, will have the time converted to the timezone that you set here. Note that once you set the time zone, all subsequent requests will work with the new timezone. If that is not your intention, then you should set the timezone back afterwards.

Parameters:
tz - the timezone to use

isSerializerRegisteredFor

public boolean isSerializerRegisteredFor(java.lang.Class classType)
checks to see if there is a serializer registered for the given class type


isDeserializerRegisteredFor

public boolean isDeserializerRegisteredFor(java.lang.String name)
checks to see if there is a deserializer registered for the given name type


addSerializer

public void addSerializer(java.lang.Class classType,
                          Serializer serializer)
registers a serializer for a particular class type. If class type already has a serializer, then it will be replaced.

Parameters:
classType - the Class type to serialize for
serializer - the serializer that will do the work

addDeserializer

public void addDeserializer(java.lang.String name,
                            Deserializer deserializer)
registers a deserializer for the particular name type. If the name type already has a deserializer, then it will be replaced.

Parameters:
name - the name (ie. int, i4, base64) of the type to deserialize for
deserializer - the deserializer

init

protected void init()

initString

protected void initString()
initializes the serializer/deserializer for the given type


initDouble

protected void initDouble()
initializes the serializer/deserializer for the given type


initDate

protected void initDate()
initializes the serializer/deserializer for the given type


initBase64

protected void initBase64()
initializes the serializer/deserializer for the given type


initBoolean

protected void initBoolean()
initializes the serializer/deserializer for the given type


initInt

protected void initInt()
initializes the serializer/deserializer for the given type


initArray

protected void initArray()
initializes the serializer/deserializer for the given type


initStruct

protected void initStruct()
initializes the serializer/deserializer for the given type



Copyright © 2001-2005 Echomine. All Rights Reserved.