Class JdkSerializationRedisSerializer
java.lang.Object
org.springframework.data.redis.serializer.JdkSerializationRedisSerializer
- All Implemented Interfaces:
RedisSerializer<Object>
Java Serialization Redis serializer. Delegates to the default (Java based)
serializer
and
DefaultDeserializer
. This serializer
can be constructed with either custom
ClassLoader
or own converters
.- Author:
- Mark Pollack, Costin Leau, Mark Paluch, Christoph Strobl
-
Constructor Summary
ConstructorDescriptionCreates a newJdkSerializationRedisSerializer
using the default class loader.JdkSerializationRedisSerializer
(ClassLoader classLoader) Creates a newJdkSerializationRedisSerializer
using aClassLoader
.JdkSerializationRedisSerializer
(org.springframework.core.convert.converter.Converter<Object, byte[]> serializer, org.springframework.core.convert.converter.Converter<byte[], Object> deserializer) Creates a newJdkSerializationRedisSerializer
using aconverters
to serialize and deserialize objects. -
Method Summary
Modifier and TypeMethodDescriptiondeserialize
(byte[] bytes) Deserialize an object from the given binary data.byte[]
Serialize the given object to binary data.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.data.redis.serializer.RedisSerializer
canSerialize, getTargetType
-
Constructor Details
-
JdkSerializationRedisSerializer
public JdkSerializationRedisSerializer()Creates a newJdkSerializationRedisSerializer
using the default class loader. -
JdkSerializationRedisSerializer
Creates a newJdkSerializationRedisSerializer
using aClassLoader
.- Parameters:
classLoader
- theClassLoader
to use for deserialization. Can be null.- Since:
- 1.7
-
JdkSerializationRedisSerializer
public JdkSerializationRedisSerializer(org.springframework.core.convert.converter.Converter<Object, byte[]> serializer, org.springframework.core.convert.converter.Converter<byte[], Object> deserializer) Creates a newJdkSerializationRedisSerializer
using aconverters
to serialize and deserialize objects.- Parameters:
serializer
- must not be nulldeserializer
- must not be null- Since:
- 1.7
-
-
Method Details
-
serialize
Description copied from interface:RedisSerializer
Serialize the given object to binary data.- Specified by:
serialize
in interfaceRedisSerializer<Object>
- Parameters:
value
- object to serialize. Can be null.- Returns:
- the equivalent binary data. Can be null.
-
deserialize
Description copied from interface:RedisSerializer
Deserialize an object from the given binary data.- Specified by:
deserialize
in interfaceRedisSerializer<Object>
- Parameters:
bytes
- object binary representation. Can be null.- Returns:
- the equivalent object instance. Can be null.
-