Package de.timroes.axmlrpc.serializer
Class SerializerHandler
- java.lang.Object
-
- de.timroes.axmlrpc.serializer.SerializerHandler
-
public class SerializerHandler extends java.lang.Object
The serializer handler serializes and deserialized objects. It takes an object, determine its type and let the responsible handler serialize it. For deserialization it looks at the xml tag around the element. The class is designed as a kind of singleton, so it can be accessed from anywhere in the library.- Author:
- Tim Roes
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
TYPE_ARRAY
static java.lang.String
TYPE_BASE64
static java.lang.String
TYPE_BOOLEAN
static java.lang.String
TYPE_DATETIME
static java.lang.String
TYPE_DOUBLE
static java.lang.String
TYPE_INT
static java.lang.String
TYPE_INT2
static java.lang.String
TYPE_LONG
static java.lang.String
TYPE_NULL
static java.lang.String
TYPE_STRING
static java.lang.String
TYPE_STRUCT
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
deserialize(org.w3c.dom.Element element)
Deserializes an incoming xml element to an java object.static SerializerHandler
getDefault()
Return the instance of the SerializerHandler.static void
initialize(int flags)
Initialize the serialization handler.XmlElement
serialize(java.lang.Object object)
Serialize an object to its representation as an xml element.
-
-
-
Field Detail
-
TYPE_STRING
public static final java.lang.String TYPE_STRING
- See Also:
- Constant Field Values
-
TYPE_BOOLEAN
public static final java.lang.String TYPE_BOOLEAN
- See Also:
- Constant Field Values
-
TYPE_INT
public static final java.lang.String TYPE_INT
- See Also:
- Constant Field Values
-
TYPE_INT2
public static final java.lang.String TYPE_INT2
- See Also:
- Constant Field Values
-
TYPE_LONG
public static final java.lang.String TYPE_LONG
- See Also:
- Constant Field Values
-
TYPE_DOUBLE
public static final java.lang.String TYPE_DOUBLE
- See Also:
- Constant Field Values
-
TYPE_DATETIME
public static final java.lang.String TYPE_DATETIME
- See Also:
- Constant Field Values
-
TYPE_STRUCT
public static final java.lang.String TYPE_STRUCT
- See Also:
- Constant Field Values
-
TYPE_ARRAY
public static final java.lang.String TYPE_ARRAY
- See Also:
- Constant Field Values
-
TYPE_BASE64
public static final java.lang.String TYPE_BASE64
- See Also:
- Constant Field Values
-
TYPE_NULL
public static final java.lang.String TYPE_NULL
- See Also:
- Constant Field Values
-
-
Method Detail
-
initialize
public static void initialize(int flags)
Initialize the serialization handler. This method must be called before the get method returns any object.- Parameters:
flags
- The flags that has been set in the XMLRPCClient.- See Also:
XMLRPCClient
-
getDefault
public static SerializerHandler getDefault()
Return the instance of the SerializerHandler. It must have been initialized with initialize() before.- Returns:
- The instance of the SerializerHandler.
-
deserialize
public java.lang.Object deserialize(org.w3c.dom.Element element) throws XMLRPCException
Deserializes an incoming xml element to an java object. The xml element must be the value element around the type element. The type of the returning object depends on the type tag.- Parameters:
element
- An type element from within a value tag.- Returns:
- The deserialized object.
- Throws:
XMLRPCException
- Will be thrown whenever an error occurs.
-
serialize
public XmlElement serialize(java.lang.Object object) throws XMLRPCException
Serialize an object to its representation as an xml element. The xml element will be the type element for the use within a value tag.- Parameters:
object
- The object that should be serialized.- Returns:
- The xml representation of this object.
- Throws:
XMLRPCException
- Will be thrown, if an error occurs (e.g. the object cannot be serialized to an xml element.
-
-