public class GenericJackson2JsonRedisSerializer extends Object implements RedisSerializer<Object>
RedisSerializer that maps objects to JSON using dynamic typing.| 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) |
static void |
registerNullValueSerializer(com.fasterxml.jackson.databind.ObjectMapper objectMapper,
String classPropertyTypeName)
Register
NullValueSerializer in the given ObjectMapper with an optional
classPropertyTypeName. |
byte[] |
serialize(Object source)
Serialize the given object to binary data.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbyteArray, canSerialize, getTargetType, java, java, json, stringpublic 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 static void registerNullValueSerializer(com.fasterxml.jackson.databind.ObjectMapper objectMapper,
@Nullable
String classPropertyTypeName)
NullValueSerializer in the given ObjectMapper with an optional
classPropertyTypeName. This method should be called by code that customizes
GenericJackson2JsonRedisSerializer by providing an external ObjectMapper.objectMapper - the object mapper to customize.classPropertyTypeName - name of the type property. Defaults to @class if null/empty.public byte[] serialize(@Nullable Object source) throws SerializationException
RedisSerializerserialize in interface RedisSerializer<Object>source - object to serialize. Can be null.SerializationExceptionpublic Object deserialize(@Nullable byte[] source) throws SerializationException
RedisSerializerdeserialize 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.SerializationExceptionCopyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.