camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: [Converter] Generics ?
Date Tue, 14 Sep 2010 15:14:57 GMT
On Tue, Sep 14, 2010 at 4:58 PM, Olivier.Roger <olivier.roger@bsb.com> wrote:
>
> hello Camel!
>
> Is it possible to use generics in annotated converters ?
>
> I tried to do this
>
>    @Converter
>    public <T> T toPayload(Message<T> msg){
>        return msg.getPayload();
>    }
>
> Which does not work. However, replacing <T> by a real class definition is
> working for that type.
> I would like to avoid to create one converter for each type of payload my
> messages can have, is that possible ?
>

Use the @FallbackConverter
http://camel.apache.org/type-converter.html


> Thanks in advance,
>
> Olivier
> --
> View this message in context: http://camel.465427.n5.nabble.com/Converter-Generics-tp2839250p2839250.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Mime
View raw message