Package com.caucho.hessian.io
Class SerializerFactory
java.lang.Object
com.caucho.hessian.io.AbstractSerializerFactory
com.caucho.hessian.io.SerializerFactory
- Direct Known Subclasses:
BeanSerializerFactory
Factory for returning serialization methods.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CollectionSerializer
protected Serializer
protected ArrayList
protected MapSerializer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFactory
(AbstractSerializerFactory factory) Adds a factory.static SerializerFactory
protected Deserializer
Returns a custom serializer the classprotected Deserializer
Returns the default serializer for a class that isn't matched directly.protected Serializer
Returns the default serializer for a class that isn't matched directly.getDeserializer
(Class cl) Returns the deserializer for a class.getDeserializer
(String type) Returns a deserializer based on a string type.getListDeserializer
(String type) Reads the object as a map.getListDeserializer
(String type, Class cl) Reads the object as a map.getObjectDeserializer
(String type) Reads the object as a map.getObjectDeserializer
(String type, Class cl) Reads the object as a map.getObjectSerializer
(Class<?> cl) Returns the serializer for a class.getSerializer
(Class cl) Returns the serializer for a class.boolean
If true, non-serializable objects are allowed.protected Deserializer
protected Serializer
loadSerializer
(Class<?> cl) readList
(AbstractHessianInput in, int length, String type) Reads the object as a list.readMap
(AbstractHessianInput in, String type) Reads the object as a map.readObject
(AbstractHessianInput in, String type, String[] fieldNames) Reads the object as a map.void
setAllowNonSerializable
(boolean allow) If true, non-serializable objects are allowed.void
setSendCollectionType
(boolean isSendType) Set true if the collection serializer should send the java type.
-
Field Details
-
_defaultSerializer
-
_factories
-
_collectionSerializer
-
_mapSerializer
-
-
Constructor Details
-
SerializerFactory
public SerializerFactory() -
SerializerFactory
-
-
Method Details
-
createDefault
-
getClassLoader
-
setSendCollectionType
public void setSendCollectionType(boolean isSendType) Set true if the collection serializer should send the java type. -
addFactory
Adds a factory. -
setAllowNonSerializable
public void setAllowNonSerializable(boolean allow) If true, non-serializable objects are allowed. -
isAllowNonSerializable
public boolean isAllowNonSerializable()If true, non-serializable objects are allowed. -
getObjectSerializer
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
-
getSerializer
Returns the serializer for a class.- Specified by:
getSerializer
in classAbstractSerializerFactory
- Parameters:
cl
- the class of the object that needs to be serialized.- Returns:
- a serializer object for the serialization.
- Throws:
HessianProtocolException
-
loadSerializer
- Throws:
HessianProtocolException
-
getDefaultSerializer
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
Returns the deserializer for a class.- Specified by:
getDeserializer
in classAbstractSerializerFactory
- Parameters:
cl
- the class of the object that needs to be deserialized.- Returns:
- a deserializer object for the serialization.
- Throws:
HessianProtocolException
-
loadDeserializer
- Throws:
HessianProtocolException
-
getCustomDeserializer
Returns a custom serializer the class- Parameters:
cl
- the class of the object that needs to be serialized.- Returns:
- a serializer object for the serialization.
-
getDefaultDeserializer
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 Object readList(AbstractHessianInput in, int length, String type) throws HessianProtocolException, IOException Reads the object as a list.- Throws:
HessianProtocolException
IOException
-
readMap
public Object readMap(AbstractHessianInput in, String type) throws HessianProtocolException, IOException Reads the object as a map.- Throws:
HessianProtocolException
IOException
-
readObject
public Object readObject(AbstractHessianInput in, String type, String[] fieldNames) throws HessianProtocolException, IOException Reads the object as a map.- Throws:
HessianProtocolException
IOException
-
getObjectDeserializer
Reads the object as a map.- Throws:
HessianProtocolException
-
getObjectDeserializer
Reads the object as a map.- Throws:
HessianProtocolException
-
getListDeserializer
Reads the object as a map.- Throws:
HessianProtocolException
-
getListDeserializer
Reads the object as a map.- Throws:
HessianProtocolException
-
getDeserializer
Returns a deserializer based on a string type.- Throws:
HessianProtocolException
-