public class GenericJackson2JsonRedisSerializer extends Object implements RedisSerializer<Object>
Constructor and Description |
---|
GenericJackson2JsonRedisSerializer()
Creates
GenericJackson2JsonRedisSerializer and configures ObjectMapper for default typing. |
GenericJackson2JsonRedisSerializer(com.fasterxml.jackson.databind.ObjectMapper mapper)
Setting a custom-configured
ObjectMapper is one way to take further control of the JSON serialization
process. |
GenericJackson2JsonRedisSerializer(String classPropertyTypeName)
Creates
GenericJackson2JsonRedisSerializer and configures ObjectMapper for default typing using the
given name. |
Modifier and Type | Method and Description |
---|---|
Object |
deserialize(byte[] source)
Deserialize an object from the given binary data.
|
<T> T |
deserialize(byte[] source,
Class<T> type) |
byte[] |
serialize(Object source)
Serialize the given object to binary data.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
java, java, json, string
public GenericJackson2JsonRedisSerializer()
GenericJackson2JsonRedisSerializer
and configures ObjectMapper
for default typing.public GenericJackson2JsonRedisSerializer(@Nullable String classPropertyTypeName)
GenericJackson2JsonRedisSerializer
and configures ObjectMapper
for default typing using the
given name. In case of an empty or null String the default
JsonTypeInfo.Id#CLASS
will be used.classPropertyTypeName
- Name of the JSON property holding type information. Can be null.public GenericJackson2JsonRedisSerializer(com.fasterxml.jackson.databind.ObjectMapper mapper)
ObjectMapper
is one way to take further control of the JSON serialization
process. For example, an extended SerializerFactory
can be configured that provides custom serializers for
specific types.mapper
- must not be null.public byte[] serialize(@Nullable Object source) throws SerializationException
RedisSerializer
serialize
in interface RedisSerializer<Object>
source
- object to serialize. Can be null.SerializationException
public Object deserialize(@Nullable byte[] source) throws SerializationException
RedisSerializer
deserialize
in interface RedisSerializer<Object>
source
- object binary representation. Can be null.SerializationException
@Nullable public <T> T deserialize(@Nullable byte[] source, Class<T> type) throws SerializationException
source
- can be null.type
- must not be null.SerializationException
Copyright © 2011–2019 Pivotal Software, Inc.. All rights reserved.