Support generics in the JsonToObjectTransformer (#2819)
* Support generics in the `JsonToObjectTransformer` * Deprecate `JsonObjectMapperAdapter` if favor of `default` methods in the `JsonObjectMapper` * Introduce `JsonObjectMapper.fromJson(Object, ResolvableType)` to support generics during deserialization * Add `JsonHeaders.RESOLVABLE_TYPE` header handling for the `ResolvableType` management * Add `ResolvableType` argument into the `JsonToObjectTransformer` * Change the `JsonToObjectTransformer` logic to consult request message headers first * Add `ResolvableType`-based factory method into the `Transformers` * Document the change * * Use `0` for conversion to array for headers to remove in the `JsonToObjectTransformer`
This commit is contained in:
committed by
Gary Russell
parent
8f86ef918c
commit
5421574ef5
@@ -449,6 +449,10 @@ See <<spel-property-accessors>> for more information.
|
||||
|
||||
Beginning with version 5.1, the `resultType` can be configured as `BYTES` to produce a message with the `byte[]` payload for convenience when working with downstream handlers which operate with this data type.
|
||||
|
||||
Starting with version 5.2, the `JsonToObjectTransformer` can be configured with a `ResolvableType` to support generics during deserialization with the target JSON processor.
|
||||
Also this component now consults request message headers first for the presence of the `JsonHeaders.RESOLVABLE_TYPE` or `JsonHeaders.TYPE_ID` and falls back to the configured type otherwise.
|
||||
The `ObjectToJsonTransformer` now also populates a `JsonHeaders.RESOLVABLE_TYPE` header based on the request message payload for any possible downstream scenarios.
|
||||
|
||||
[[transformer-annotation]]
|
||||
==== Configuring a Transformer with Annotations
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@ See <<rate-limiter-advice>> for more information.
|
||||
[[x5.2-general]]
|
||||
=== General Changes
|
||||
|
||||
The `JsonToObjectTransformer` now supports generics for the target object to deserialize into.
|
||||
See <<json-transformers>> for more information.
|
||||
|
||||
[[x5.2-amqp]]
|
||||
==== AMQP Changes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user