Class GenericJackson3JsonRedisSerializer.GenericJackson3JsonRedisSerializerBuilder<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.GenericJackson3JsonRedisSerializer.GenericJackson3JsonRedisSerializerBuilder<B>
- Type Parameters:
B
- type of theMapperBuilder
.
- Enclosing class:
GenericJackson3JsonRedisSerializer
public static class GenericJackson3JsonRedisSerializer.GenericJackson3JsonRedisSerializerBuilder<B extends tools.jackson.databind.cfg.MapperBuilder<? extends tools.jackson.databind.ObjectMapper, ? extends tools.jackson.databind.cfg.MapperBuilder<?,?>>>
extends Object
GenericJackson3JsonRedisSerializer.GenericJackson3JsonRedisSerializerBuilder
wraps around a JsonMapper.Builder
providing dedicated
methods to configure aspects like NullValue
serialization strategy for the resulting ObjectMapper
to be used with GenericJackson3JsonRedisSerializer
as well as potential Object/-reader
and -writer
settings.- Since:
- 4.0
- Author:
- Christoph Strobl
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build a newGenericJackson3JsonRedisSerializer
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
(Jackson3ObjectReader reader) Configures theJackson3ObjectReader
.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
(Jackson3ObjectWriter writer) Configures theJackson3ObjectWriter
.
-
Method Details
-
enableSpringCacheNullValueSupport
@Contract("-> this") public GenericJackson3JsonRedisSerializer.GenericJackson3JsonRedisSerializerBuilder<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 GenericJackson3JsonRedisSerializer.GenericJackson3JsonRedisSerializerBuilder<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 GenericJackson3JsonRedisSerializer.GenericJackson3JsonRedisSerializerBuilder<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 GenericJackson3JsonRedisSerializer.GenericJackson3JsonRedisSerializerBuilder<B> enableDefaultTyping(tools.jackson.databind.jsontype.PolymorphicTypeValidator typeValidator) Enablesdefault typing
using the givenPolymorphicTypeValidator
.- Returns:
this
builder.
-
typeValidator
@Contract("_ -> this") public GenericJackson3JsonRedisSerializer.GenericJackson3JsonRedisSerializerBuilder<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 GenericJackson3JsonRedisSerializer.GenericJackson3JsonRedisSerializerBuilder<B> typePropertyName(String typePropertyName) Configure the type property name used for default typing andenableSpringCacheNullValueSupport()
.- Returns:
this
builder.
-
writer
@Contract("_ -> this") public GenericJackson3JsonRedisSerializer.GenericJackson3JsonRedisSerializerBuilder<B> writer(Jackson3ObjectWriter writer) Configures theJackson3ObjectWriter
.- Parameters:
writer
- must not be null.- Returns:
this
builder.
-
reader
@Contract("_ -> this") public GenericJackson3JsonRedisSerializer.GenericJackson3JsonRedisSerializerBuilder<B> reader(Jackson3ObjectReader reader) Configures theJackson3ObjectReader
.- Parameters:
reader
- must not be null.- Returns:
this
builder.
-
customize
@Contract("_ -> this") public GenericJackson3JsonRedisSerializer.GenericJackson3JsonRedisSerializerBuilder<B> customize(Consumer<B> mapperBuilderCustomizer) - Parameters:
mapperBuilderCustomizer
- the configurer to apply to theObjectMapper
builder.- Returns:
this
builder.
-
build
Build a newGenericJackson3JsonRedisSerializer
instance using the configured settings.- Returns:
- a new
GenericJackson3JsonRedisSerializer
instance.
-