public class SerializerFactory extends AbstractSerializerFactory
Modifier and Type | Field and Description |
---|---|
private Deserializer |
_arrayListDeserializer |
private java.util.concurrent.ConcurrentHashMap |
_cachedDeserializerMap |
private java.util.concurrent.ConcurrentHashMap |
_cachedSerializerMap |
private java.util.HashMap |
_cachedTypeDeserializerMap |
protected CollectionSerializer |
_collectionSerializer |
private ContextSerializerFactory |
_contextFactory |
private static java.util.WeakHashMap<java.lang.ClassLoader,java.lang.ref.SoftReference<SerializerFactory>> |
_defaultFactoryRefMap |
protected Serializer |
_defaultSerializer |
protected java.util.ArrayList |
_factories |
private Deserializer |
_hashMapDeserializer |
private boolean |
_isAllowNonSerializable |
private boolean |
_isEnableUnsafeSerializer |
private java.lang.ref.WeakReference<java.lang.ClassLoader> |
_loaderRef |
protected MapSerializer |
_mapSerializer |
private static java.util.HashMap |
_staticTypeMap |
private static java.lang.ClassLoader |
_systemClassLoader |
private static java.util.logging.Logger |
log |
private static Deserializer |
OBJECT_DESERIALIZER |
Constructor and Description |
---|
SerializerFactory() |
SerializerFactory(java.lang.ClassLoader loader) |
Modifier and Type | Method and Description |
---|---|
private static void |
addBasic(java.lang.Class<?> cl,
java.lang.String typeName,
int type) |
void |
addFactory(AbstractSerializerFactory factory)
Adds a factory.
|
static SerializerFactory |
createDefault() |
java.lang.ClassLoader |
getClassLoader() |
protected Deserializer |
getCustomDeserializer(java.lang.Class cl)
Returns a custom serializer the class
|
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 |
getListDeserializer(java.lang.String type)
Reads the object as a map.
|
Deserializer |
getListDeserializer(java.lang.String type,
java.lang.Class cl)
Reads the object as a map.
|
Deserializer |
getObjectDeserializer(java.lang.String type)
Reads the object as a map.
|
Deserializer |
getObjectDeserializer(java.lang.String type,
java.lang.Class cl)
Reads the object as a map.
|
Serializer |
getObjectSerializer(java.lang.Class<?> cl)
Returns the serializer for a class.
|
Serializer |
getSerializer(java.lang.Class cl)
Returns the serializer for a class.
|
boolean |
isAllowNonSerializable()
If true, non-serializable objects are allowed.
|
protected Deserializer |
loadDeserializer(java.lang.Class cl) |
protected Serializer |
loadSerializer(java.lang.Class<?> cl) |
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.
|
java.lang.Object |
readObject(AbstractHessianInput in,
java.lang.String type,
java.lang.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.
|
private static final java.util.logging.Logger log
private static final Deserializer OBJECT_DESERIALIZER
private static final java.lang.ClassLoader _systemClassLoader
private static final java.util.HashMap _staticTypeMap
private static final java.util.WeakHashMap<java.lang.ClassLoader,java.lang.ref.SoftReference<SerializerFactory>> _defaultFactoryRefMap
private ContextSerializerFactory _contextFactory
private java.lang.ref.WeakReference<java.lang.ClassLoader> _loaderRef
protected Serializer _defaultSerializer
protected java.util.ArrayList _factories
protected CollectionSerializer _collectionSerializer
protected MapSerializer _mapSerializer
private Deserializer _hashMapDeserializer
private Deserializer _arrayListDeserializer
private java.util.concurrent.ConcurrentHashMap _cachedSerializerMap
private java.util.concurrent.ConcurrentHashMap _cachedDeserializerMap
private java.util.HashMap _cachedTypeDeserializerMap
private boolean _isAllowNonSerializable
private boolean _isEnableUnsafeSerializer
public SerializerFactory()
public SerializerFactory(java.lang.ClassLoader loader)
public static SerializerFactory createDefault()
public java.lang.ClassLoader getClassLoader()
public void setSendCollectionType(boolean isSendType)
public void addFactory(AbstractSerializerFactory factory)
public void setAllowNonSerializable(boolean allow)
public boolean isAllowNonSerializable()
public Serializer getObjectSerializer(java.lang.Class<?> cl) throws HessianProtocolException
cl
- the class of the object that needs to be serialized.HessianProtocolException
public Serializer getSerializer(java.lang.Class cl) throws HessianProtocolException
getSerializer
in class AbstractSerializerFactory
cl
- the class of the object that needs to be serialized.HessianProtocolException
protected Serializer loadSerializer(java.lang.Class<?> cl) throws HessianProtocolException
HessianProtocolException
protected Serializer getDefaultSerializer(java.lang.Class cl)
cl
- the class of the object that needs to be serialized.public Deserializer getDeserializer(java.lang.Class cl) throws HessianProtocolException
getDeserializer
in class AbstractSerializerFactory
cl
- the class of the object that needs to be deserialized.HessianProtocolException
protected Deserializer loadDeserializer(java.lang.Class cl) throws HessianProtocolException
HessianProtocolException
protected Deserializer getCustomDeserializer(java.lang.Class cl)
cl
- the class of the object that needs to be serialized.protected Deserializer getDefaultDeserializer(java.lang.Class cl)
cl
- the class of the object that needs to be serialized.public java.lang.Object readList(AbstractHessianInput in, int length, java.lang.String type) throws HessianProtocolException, java.io.IOException
HessianProtocolException
java.io.IOException
public java.lang.Object readMap(AbstractHessianInput in, java.lang.String type) throws HessianProtocolException, java.io.IOException
HessianProtocolException
java.io.IOException
public java.lang.Object readObject(AbstractHessianInput in, java.lang.String type, java.lang.String[] fieldNames) throws HessianProtocolException, java.io.IOException
HessianProtocolException
java.io.IOException
public Deserializer getObjectDeserializer(java.lang.String type, java.lang.Class cl) throws HessianProtocolException
HessianProtocolException
public Deserializer getObjectDeserializer(java.lang.String type) throws HessianProtocolException
HessianProtocolException
public Deserializer getListDeserializer(java.lang.String type, java.lang.Class cl) throws HessianProtocolException
HessianProtocolException
public Deserializer getListDeserializer(java.lang.String type) throws HessianProtocolException
HessianProtocolException
public Deserializer getDeserializer(java.lang.String type) throws HessianProtocolException
HessianProtocolException
private static void addBasic(java.lang.Class<?> cl, java.lang.String typeName, int type)