com.caucho.hessian.io
Class SerializerFactory

java.lang.Object
  extended bycom.caucho.hessian.io.SerializerFactory
Direct Known Subclasses:
BeanSerializerFactory

public class SerializerFactory
extends java.lang.Object

Factory for returning serialization methods.


Field Summary
private  java.util.HashMap _cachedDeserializerMap
           
private  java.util.HashMap _cachedSerializerMap
           
private  java.util.HashMap _cachedTypeDeserializerMap
           
protected  Serializer _defaultSerializer
           
private static java.util.HashMap _deserializerMap
           
private  Deserializer _hashMapDeserializer
           
private static java.util.HashMap _serializerMap
           
private static java.util.HashMap _typeMap
           
 
Constructor Summary
SerializerFactory()
           
 
Method Summary
private static void addBasic(java.lang.Class cl, java.lang.String typeName, int type)
           
protected  Deserializer getDefaultDeserializer(java.lang.Class cl)
          Returns the default serializer for a class that isn't matched directly.
protected  Serializer getDefaultSerializer(java.lang.Class cl)
          Returns the default serializer for a class that isn't matched directly.
 Deserializer getDeserializer(java.lang.Class cl)
          Returns the deserializer for a class.
 Deserializer getDeserializer(java.lang.String type)
          Returns a deserializer based on a string type.
 Deserializer getObjectDeserializer(java.lang.String type)
          Reads the object as a map.
 Serializer getSerializer(java.lang.Class cl)
          Returns the serializer for a class.
 java.lang.Object readList(AbstractHessianInput in, int length, java.lang.String type)
          Reads the object as a list.
 java.lang.Object readMap(AbstractHessianInput in, java.lang.String type)
          Reads the object as a map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_serializerMap

private static java.util.HashMap _serializerMap

_deserializerMap

private static java.util.HashMap _deserializerMap

_typeMap

private static java.util.HashMap _typeMap

_defaultSerializer

protected Serializer _defaultSerializer

_hashMapDeserializer

private Deserializer _hashMapDeserializer

_cachedSerializerMap

private java.util.HashMap _cachedSerializerMap

_cachedDeserializerMap

private java.util.HashMap _cachedDeserializerMap

_cachedTypeDeserializerMap

private java.util.HashMap _cachedTypeDeserializerMap
Constructor Detail

SerializerFactory

public SerializerFactory()
Method Detail

getSerializer

public Serializer getSerializer(java.lang.Class cl)
                         throws HessianProtocolException
Returns the serializer for a class.

Parameters:
cl - the class of the object that needs to be serialized.
Returns:
a serializer object for the serialization.
Throws:
HessianProtocolException

getDefaultSerializer

protected Serializer getDefaultSerializer(java.lang.Class cl)
Returns the default serializer for a class that isn't matched directly. Application can override this method to produce bean-style serialization instead of field serialization.

Parameters:
cl - the class of the object that needs to be serialized.
Returns:
a serializer object for the serialization.

getDeserializer

public Deserializer getDeserializer(java.lang.Class cl)
                             throws HessianProtocolException
Returns the deserializer for a class.

Parameters:
cl - the class of the object that needs to be deserialized.
Returns:
a deserializer object for the serialization.
Throws:
HessianProtocolException

getDefaultDeserializer

protected Deserializer getDefaultDeserializer(java.lang.Class cl)
Returns the default serializer for a class that isn't matched directly. Application can override this method to produce bean-style serialization instead of field serialization.

Parameters:
cl - the class of the object that needs to be serialized.
Returns:
a serializer object for the serialization.

readList

public java.lang.Object readList(AbstractHessianInput in,
                                 int length,
                                 java.lang.String type)
                          throws HessianProtocolException,
                                 java.io.IOException
Reads the object as a list.

Throws:
HessianProtocolException
java.io.IOException

readMap

public java.lang.Object readMap(AbstractHessianInput in,
                                java.lang.String type)
                         throws HessianProtocolException,
                                java.io.IOException
Reads the object as a map.

Throws:
HessianProtocolException
java.io.IOException

getObjectDeserializer

public Deserializer getObjectDeserializer(java.lang.String type)
                                   throws HessianProtocolException
Reads the object as a map.

Throws:
HessianProtocolException

getDeserializer

public Deserializer getDeserializer(java.lang.String type)
                             throws HessianProtocolException
Returns a deserializer based on a string type.

Throws:
HessianProtocolException

addBasic

private static void addBasic(java.lang.Class cl,
                             java.lang.String typeName,
                             int type)