camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Okello Nelson <cn.oke...@gmail.com>
Subject Re: Bindy: Specify value of @DataField annotation using property placeholders
Date Mon, 15 Apr 2013 06:42:16 GMT
Hi Claus,

Thanks a lot for the clarification. I think such a feature would be handy,
and I hope we can have it in subsequent versions of Camel.

Kind Regards,
Okello Nelson.


On Mon, Apr 15, 2013 at 9:38 AM, Claus Ibsen <claus.ibsen@gmail.com> wrote:

> No this is not possible.
>
> And I think pos is defined as an integer? So the type would have to
> change to String, to allow you to specify the key of the property.
>
> It kinda sucks as for people not using the placeholders, they want to
> know the types.
>
> pos = 1
>
> If its a String then would need to type
>
> pos = "1"
>
>
>
>
> On Mon, Apr 15, 2013 at 8:15 AM, Okello Nelson <cn.okello@gmail.com>
> wrote:
> > Hi Guys,
> >
> > I'm using Bindy to unmarshall a CSV file. My model class looks something
> > like this:
> >
> > @CsvRecord( separator = "\\|", skipFirstLine = true)
> > @XmlRootElement( name = "SampleModel" )
> > public class SampleModel {
> >
> >           @DataField( pos = 1 )
> >           private String field1;
> >
> >          @DataField( pos = 2 )
> >          private Date field2;
> > }
> >
> >
> > Whereas this works fine, I'd like to specify the value of the @DataField
> > annotation in an external file, and have it look like:
> >
> > @DataField( pos = "${field1.pos}")
> > private String field1;
> >
> > where "pos" takes the value of "${field1.pos}" as specified in an
> external
> > properties file, instead of specifying a value directly in the model
> class.
> > Is this possible?
> >
> > Kind Regards,
> > Okello Nelson.
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: cibsen@redhat.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>



-- 
Kind Regards,
Okello Nelson
+254 722 137 826
cn.okello@gmail.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message