Class GenericJacksonJsonRedisSerializer.GenericJacksonJsonRedisSerializerBuilder<B extends tools.jackson.databind.cfg.MapperBuilder<? extends tools.jackson.databind.ObjectMapper, ? extends tools.jackson.databind.cfg.MapperBuilder<?,?>>>
java.lang.Object
org.springframework.data.redis.serializer.GenericJacksonJsonRedisSerializer.GenericJacksonJsonRedisSerializerBuilder<B>
- Type Parameters:
B
- type of theMapperBuilder
.
- Enclosing class:
GenericJacksonJsonRedisSerializer
public static class GenericJacksonJsonRedisSerializer.GenericJacksonJsonRedisSerializerBuilder<B extends tools.jackson.databind.cfg.MapperBuilder<? extends tools.jackson.databind.ObjectMapper, ? extends tools.jackson.databind.cfg.MapperBuilder<?,?>>>
extends Object
GenericJacksonJsonRedisSerializer.GenericJacksonJsonRedisSerializerBuilder
wraps around a JsonMapper.Builder
providing dedicated
methods to configure aspects like NullValue
serialization strategy for the resulting ObjectMapper
to be used with GenericJacksonJsonRedisSerializer
as well as potential Object/-reader
and -writer
settings.- Since:
- 4.0
- Author:
- Christoph Strobl
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build a newGenericJacksonJsonRedisSerializer
instance using the configured settings.enableDefaultTyping
(tools.jackson.databind.jsontype.PolymorphicTypeValidator typeValidator) Enablesdefault typing
using the givenPolymorphicTypeValidator
.Registers aStdSerializer
capable of serializing Spring CacheNullValue
using the mappers default type property.enableSpringCacheNullValueSupport
(String typePropertyName) Registers aStdSerializer
capable of serializing Spring CacheNullValue
using the given type property name.Enablesdefault typing
without any type validation constraints.reader
(JacksonObjectReader reader) Configures theJacksonObjectReader
.typePropertyName
(String typePropertyName) Configure the type property name used for default typing andenableSpringCacheNullValueSupport()
.typeValidator
(tools.jackson.databind.jsontype.PolymorphicTypeValidator typeValidator) Provide aPolymorphicTypeValidator
to validate polymorphic types during deserialization.writer
(JacksonObjectWriter writer) Configures theJacksonObjectWriter
.
-
Method Details
-
enableSpringCacheNullValueSupport
@Contract("-> this") public GenericJacksonJsonRedisSerializer.GenericJacksonJsonRedisSerializerBuilder<B> enableSpringCacheNullValueSupport()Registers aStdSerializer
capable of serializing Spring CacheNullValue
using the mappers default type property. Please make sure to activedefault typing
accordingly.- Returns:
- this.
-
enableSpringCacheNullValueSupport
@Contract("_ -> this") public GenericJacksonJsonRedisSerializer.GenericJacksonJsonRedisSerializerBuilder<B> enableSpringCacheNullValueSupport(String typePropertyName) Registers aStdSerializer
capable of serializing Spring CacheNullValue
using the given type property name. Please make sure to activedefault typing
accordingly.- Returns:
this
builder.
-
enableUnsafeDefaultTyping
@Contract("-> this") public GenericJacksonJsonRedisSerializer.GenericJacksonJsonRedisSerializerBuilder<B> enableUnsafeDefaultTyping()Enablesdefault typing
without any type validation constraints.WARNING: without restrictions of the
PolymorphicTypeValidator
deserialization is vulnerable to arbitrary code execution when reading from untrusted sources.- Returns:
this
builder.- See Also:
-
enableDefaultTyping
@Contract("_ -> this") public GenericJacksonJsonRedisSerializer.GenericJacksonJsonRedisSerializerBuilder<B> enableDefaultTyping(tools.jackson.databind.jsontype.PolymorphicTypeValidator typeValidator) Enablesdefault typing
using the givenPolymorphicTypeValidator
.- Returns:
this
builder.
-
typeValidator
@Contract("_ -> this") public GenericJacksonJsonRedisSerializer.GenericJacksonJsonRedisSerializerBuilder<B> typeValidator(tools.jackson.databind.jsontype.PolymorphicTypeValidator typeValidator) Provide aPolymorphicTypeValidator
to validate polymorphic types during deserialization.- Parameters:
typeValidator
- the validator to use, defaults to a permissive validator that allows all types.- Returns:
this
builder.
-
typePropertyName
@Contract("_ -> this") public GenericJacksonJsonRedisSerializer.GenericJacksonJsonRedisSerializerBuilder<B> typePropertyName(String typePropertyName) Configure the type property name used for default typing andenableSpringCacheNullValueSupport()
.- Returns:
this
builder.
-
writer
@Contract("_ -> this") public GenericJacksonJsonRedisSerializer.GenericJacksonJsonRedisSerializerBuilder<B> writer(JacksonObjectWriter writer) Configures theJacksonObjectWriter
.- Parameters:
writer
- must not be null.- Returns:
this
builder.
-
reader
@Contract("_ -> this") public GenericJacksonJsonRedisSerializer.GenericJacksonJsonRedisSerializerBuilder<B> reader(JacksonObjectReader reader) Configures theJacksonObjectReader
.- Parameters:
reader
- must not be null.- Returns:
this
builder.
-
customize
@Contract("_ -> this") public GenericJacksonJsonRedisSerializer.GenericJacksonJsonRedisSerializerBuilder<B> customize(Consumer<B> mapperBuilderCustomizer) - Parameters:
mapperBuilderCustomizer
- the configurer to apply to theObjectMapper
builder.- Returns:
this
builder.
-
build
Build a newGenericJacksonJsonRedisSerializer
instance using the configured settings.- Returns:
- a new
GenericJacksonJsonRedisSerializer
instance.
-