On Wed, Jul 11, 2012 at 12:40 PM, SimonH <[email protected]> wrote:
> I have a List of Objects as my Camel Message Body, and I want to convert
> these to a List of Strings by calling 'toString' on each Object. Is there
> any succinct way I can do this with the Camel Java DSL?
>
You can use a java bean or Camel processor and do the code in plain java code.
public List transformToString(List body) {
List answer = new ArrayList();
for (Object o : list) {
String s = o.toString();
answer.add(s);
}
return answer;
}
And then use that method in eg a message translator EIP
http://camel.apache.org/message-translator.html
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/How-to-transform-elements-of-a-Collection-tp5715853.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
FuseSource
Email: [email protected]
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen