On Wed, Sep 14, 2011 at 9:54 AM, Willem Jiang <willem.ji...@gmail.com> wrote:
> I think we could a construction to the BindyCsvDataFormat with class
> parameter, then we could work around this kind of issue by specifying a
> right module object to use.
>

Actually I think we should @deprecate the package mode, as you can't
have multiple models in a package, and that is really counter
intuitive.

Also with Class we do not have to do a package scan to discover the
classes. We could possible @deprecate the package configuration, and
then add support for the Class only.



> On 9/12/11 3:40 PM, Claus Ibsen wrote:
>>
>> Hi
>>
>> We would like to improve this in the future, either Camel 3.0, or earlier.
>> However we would like to avoid any big breakings and thus we need to
>> be a bit careful on the 2.x branch. For 3.0 we can of course make
>> bigger changes if it is indeed needed.
>>
>> So you can have multiple model objects in the same package, and then
>> just pin point the "main" class in the DataFormat.
>> For example as JAXB works.
>>
>> I think there is a JIRA ticket in there already for this.
>>
>>
>> On Mon, Sep 12, 2011 at 9:02 AM, c.spiegel<c.spie...@waldmann.com>  wrote:
>>>
>>> Is there any way, to tell Camel which model object to use during CSV
>>> unmarshalling?
>>>
>>> Following szenario:
>>> my.package:
>>>  -ModelObject1 (annotated with @CsvRecord)
>>>  -ModelObject2 (annotated with @CsvRecord)
>>>
>>> Both model object are totally different. I'm trying to poll a folder
>>> which
>>> includes different formated csv files:
>>>
>>> public void configure() throws Exception {
>>>                BindyCsvDataFormat dataFormat = new
>>> BindyCsvDataFormat("my.package");
>>>
>>>                from("file://data/csv?noop=true").split().body()
>>>                .unmarshal(dataFormat).process(new Processor() {
>>>
>>>                public void process(Exchange exchange) throws Exception {
>>>                        System.out.println(exchange.getIn());
>>>
>>>                }
>>>        });
>>> }
>>>
>>> Bindy fails with
>>> /java.lang.IllegalArgumentException: Some fields are missing (optional or
>>> mandatory), line : 1/
>>> because Bindy tries to bind to the wrong model object. Is there any way,
>>> to
>>> tell Bindy to which model object Bindy should bind to? The only
>>> workaround a
>>> found, is to put each model object in an own package (what is not very
>>> handy
>>> I think).
>>>
>>> Thanks for any help.
>>>
>>>
>>> --
>>> View this message in context:
>>> http://camel.465427.n5.nabble.com/Bindy-component-more-than-one-model-object-per-package-tp4793295p4793295.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>
>>
>>
>
>
> --
> Willem
> ----------------------------------
> FuseSource
> Web: http://www.fusesource.com
> Blog:    http://willemjiang.blogspot.com (English)
>         http://jnn.javaeye.com (Chinese)
> Twitter: willemjiang
> Weibo: willemjiang
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to