Interface RedisJsonSerializer
- All Superinterfaces:
RedisSerializer<Object>
- All Known Subinterfaces:
RedisJsonSerializer.Splitter
- All Known Implementing Classes:
GenericJackson2JsonRedisSerializer, GenericJacksonJsonRedisSerializer
RedisSerializer extension for converting between Java objects and JSON bytes.
Provides deserialization into specific target types, including generic types described by
ParameterizedTypeReference or ResolvableType. Also supports extracting array elements and object
members as JSON and combining members into a JSON object.
- Since:
- 4.2
- Author:
- Yordan Tsintsov, Mark Paluch, Moritz Halbritter
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceSplitter for JSON arrays and objects. -
Method Summary
Modifier and TypeMethodDescriptiondefault <T> @Nullable Tdeserialize(byte[] source, ParameterizedTypeReference<T> typeRef) Deserialize the givensourceinto an instance of the type described by aParameterizedTypeReference.deserialize(byte[] source, ResolvableType type) Deserialize the givensourceinto an instance of the type described byResolvableType.default RedisJsonSerializer.Splittersplitter()Return aRedisJsonSerializer.Splitterfor this serializer.Methods inherited from interface RedisSerializer
canSerialize, deserialize, deserialize, getTargetType, serialize
-
Method Details
-
deserialize
default <T> @Nullable T deserialize(byte[] source, ParameterizedTypeReference<T> typeRef) throws SerializationException Deserialize the givensourceinto an instance of the type described by aParameterizedTypeReference.Use this variant for generic types such as
List<Person>that cannot be expressed as aClass.- Type Parameters:
T- the target type.- Parameters:
source- the JSON bytes to read.typeRef- the reference describing the target type.- Returns:
- the deserialized object, or null if
sourceis empty or represents JSON null. - Throws:
SerializationException- if the JSON cannot be deserialized.
-
deserialize
Deserialize the givensourceinto an instance of the type described byResolvableType.Use this variant for generic types such as
List<Person>that cannot be expressed as aClass.- Parameters:
source- the JSON bytes to read.type- the target type.- Returns:
- the deserialized object, or null if
sourceis empty or represents JSON null. - Throws:
SerializationException- if the JSON cannot be deserialized.
-
splitter
Return aRedisJsonSerializer.Splitterfor this serializer.
-