Class GenericJackson2JsonRedisSerializer.GenericJackson2JsonRedisSerializerBuilder
java.lang.Object
org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer.GenericJackson2JsonRedisSerializerBuilder
- Enclosing class:
- GenericJackson2JsonRedisSerializer
public static class GenericJackson2JsonRedisSerializer.GenericJackson2JsonRedisSerializerBuilder
extends Object
Builder for configuring and creating a
GenericJackson2JsonRedisSerializer
.- Since:
- 3.3.1
- Author:
- Anne Lee, Mark Paluch
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Creates a new instance ofGenericJackson2JsonRedisSerializer
with configuration options applied.defaultTyping
(boolean defaultTyping) Enable or disable default typing.nullValueSerializer
(com.fasterxml.jackson.databind.ser.std.StdSerializer<NullValue> nullValueSerializer) Register aserializer
forNullValue
.objectMapper
(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Configure a providedObjectMapper
.reader
(JacksonObjectReader reader) ConfigureJacksonObjectReader
.registerNullValueSerializer
(boolean registerNullValueSerializer) Configure whether to register aserializer
forNullValue
serialization.typeHintPropertyName
(String typeHintPropertyName) Configure a property name to that represents the type hint.writer
(JacksonObjectWriter writer) ConfigureJacksonObjectWriter
.
-
Method Details
-
defaultTyping
public GenericJackson2JsonRedisSerializer.GenericJackson2JsonRedisSerializerBuilder defaultTyping(boolean defaultTyping) Enable or disable default typing. Enabling default typing will overrideObjectMapper.setDefaultTyping(com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder)
for a givenObjectMapper
. Default typing is enabled by default if noObjectMapper
is provided.- Parameters:
defaultTyping
- whether to enable/disable default typing. Enabled by default if theObjectMapper
is not provided.- Returns:
- this
GenericJackson2JsonRedisSerializer.GenericJackson2JsonRedisSerializerBuilder
.
-
typeHintPropertyName
public GenericJackson2JsonRedisSerializer.GenericJackson2JsonRedisSerializerBuilder typeHintPropertyName(String typeHintPropertyName) Configure a property name to that represents the type hint.- Parameters:
typeHintPropertyName
-name
of the JSON property holding type information.- Returns:
- this
GenericJackson2JsonRedisSerializer.GenericJackson2JsonRedisSerializerBuilder
.
-
objectMapper
public GenericJackson2JsonRedisSerializer.GenericJackson2JsonRedisSerializerBuilder objectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Configure a providedObjectMapper
. Note that the providedObjectMapper
can be reconfigured with anullValueSerializer
or default typing depending on the builder configuration.- Parameters:
objectMapper
- must not be null.- Returns:
- this
GenericJackson2JsonRedisSerializer.GenericJackson2JsonRedisSerializerBuilder
.
-
reader
public GenericJackson2JsonRedisSerializer.GenericJackson2JsonRedisSerializerBuilder reader(JacksonObjectReader reader) ConfigureJacksonObjectReader
.- Parameters:
reader
- must not be null.- Returns:
- this
GenericJackson2JsonRedisSerializer.GenericJackson2JsonRedisSerializerBuilder
.
-
writer
public GenericJackson2JsonRedisSerializer.GenericJackson2JsonRedisSerializerBuilder writer(JacksonObjectWriter writer) ConfigureJacksonObjectWriter
.- Parameters:
writer
- must not be null.- Returns:
- this
GenericJackson2JsonRedisSerializer.GenericJackson2JsonRedisSerializerBuilder
.
-
nullValueSerializer
public GenericJackson2JsonRedisSerializer.GenericJackson2JsonRedisSerializerBuilder nullValueSerializer(com.fasterxml.jackson.databind.ser.std.StdSerializer<NullValue> nullValueSerializer) Register aserializer
forNullValue
.- Parameters:
nullValueSerializer
- theStdSerializer
to use forNullValue
serialization, must not be null.- Returns:
- this
GenericJackson2JsonRedisSerializer.GenericJackson2JsonRedisSerializerBuilder
.
-
registerNullValueSerializer
public GenericJackson2JsonRedisSerializer.GenericJackson2JsonRedisSerializerBuilder registerNullValueSerializer(boolean registerNullValueSerializer) Configure whether to register aserializer
forNullValue
serialization. The default serializer considerstypeHintPropertyName(String)
.- Parameters:
registerNullValueSerializer
-true
to register the default serializer;false
otherwise.- Returns:
- this
GenericJackson2JsonRedisSerializer.GenericJackson2JsonRedisSerializerBuilder
.
-
build
Creates a new instance ofGenericJackson2JsonRedisSerializer
with configuration options applied. Creates also a newObjectMapper
if none was provided.- Returns:
- a new instance of
GenericJackson2JsonRedisSerializer
.
-