Friday, September 24, 2010

Camel supports field omitting for XStream data format

I committed patch to the Apache Camel XStream data format. It provides support for omitting selected fields. Claus Ibsen added Spring DSL to it and now it's ready to go to the next version of Camel (2.5).

Omitting selected fields is an useful option of XStream. By default XStream includes all fields of the object in the XML (un)marshalling process. Method XStream.omitFields() configures XStream to ignore selected fields for given class and not taking them under consideration during the XML (de)serialization process.

Here is the sample usage with Camel:

<camelContext xmlns="">

    <xstream id="xstream">
    <!-- omit the qux field from the Bar class -->
        <omitField class="foo.Bar">
    <from uri="direct:start"/>
    <marshal ref="xstream"/>
    <convertBodyTo type="String"/>
    <to uri="mock:result"/>


No comments:

Post a Comment