INT-3130: Add result-type to <o-to-j-transformer>

JIRA: https://jira.springsource.org/browse/INT-3130

* add `result-type` attribute to the `<object-to-json-transformer>`
based on enumeration values: `STRING`, `NODE`
* Provide implementations for methods to convert value to the node representation
* Refactoring according new generic option in the `JsonObjectMapper`
* Add tests and documentation

Need Migration Guide note according this refactoring

INT-3130: remove some deprecation and JavaDocs

Addressed PR comments

Doc Polishing
This commit is contained in:
Artem Bilan
2014-01-27 15:58:29 +02:00
committed by Gary Russell
parent 9005938ab5
commit 062e7bc9d2
21 changed files with 165 additions and 199 deletions

View File

@@ -361,13 +361,23 @@ public class Foo {
In addition to JSON Transformers, Spring Integration provides a built-in <emphasis>#jsonPath</emphasis>
SpEL function for use in expressions. For more information see <xref linkend="spel"/>.
</para>
<para>
<para id="transformer-xpath-spel-function">
<emphasis role="bold">#xpath SpEL Function</emphasis>
</para>
<para>
Since version <emphasis>3.0</emphasis>, Spring Integration also provides a built-in <emphasis>#xpath</emphasis>
SpEL function for use in expressions. For more information see <xref linkend="xpath-spel-function"/>.
</para>
<para>
Beginning with <emphasis>version 4.0</emphasis>, the <classname>ObjectToJsonTransformer</classname>
supports the <code>resultType</code> property, to specify the <emphasis>node</emphasis> JSON representation.
The result node tree representation depends on the implementation of the provided <interfacename>JsonObjectMapper</interfacename>.
By default, the <classname>ObjectToJsonTransformer</classname> uses a <classname>Jackson2JsonObjectMapper</classname>
and delegates the conversion of the object to the node tree to the <classname>ObjectMapper#valueToTree</classname> method.
The node JSON representation provides efficiency for using the <classname>JsonPropertyAccessor</classname>, when the
downstream message flow uses SpEL expressions with access to the properties of the JSON data. See
<xref linkend="spel-property-accessors"/>.
</para>
</section>
<section id="transformer-annotation">

View File

@@ -32,7 +32,7 @@
<ulink url="https://github.com/spring-projects/spring-integration/wiki/Spring-Integration-3.0-to-4.0-Migration-Guide"
>Migration Guide</ulink>.
</para>
<section id="3.0-xpath-header-enricher-header-type">
<section id="4.0-xpath-header-enricher-header-type">
<title>Header Type for XPath Header Enricher</title>
<para>
The <code>header-type</code> attribute has been introduced for the <code>header</code> sub-element of the
@@ -41,5 +41,14 @@
For more information see <xref linkend="xml-xpath-header-enricher"/>.
</para>
</section>
<section id="4.0-object-to-json-transformer-result-type">
<title>Object To Json Transformer: Node Result</title>
<para>
The <code>result-type</code> attribute has been introduced for the <code>&lt;int:object-to-json-transformer&gt;</code>.
This attribute provides the target type for the result of object mapping to JSON.
It supports <code>STRING</code> (default) and <code>NODE</code>.
For more information see <xref linkend="transformer-xpath-spel-function"/>.
</para>
</section>
</section>
</chapter>