[
https://issues.apache.org/jira/browse/CAMEL-6234?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13655301#comment-13655301
]
Christian Müller commented on CAMEL-6234:
-----------------------------------------
I documented the limitation in the WIKI page.
> camel-bindy - Multiple models in the same package lead to unpredictable
> results
> -------------------------------------------------------------------------------
>
> Key: CAMEL-6234
> URL: https://issues.apache.org/jira/browse/CAMEL-6234
> Project: Camel
> Issue Type: Bug
> Components: camel-bindy
> Affects Versions: 2.9.6, 2.10.4
> Reporter: Hadrian Zbarcea
> Assignee: Hadrian Zbarcea
> Fix For: 2.11.0
>
>
> BindyCsvDataFormat only holds one model. When multiple models are defined in
> the same package or field positions overlap, only one @DataField is kept (the
> last one) overwriting the previous mapping. This leads to unpredictable
> behavior, from the wrong field value being populated, to format mismatch
> exceptions for fields of different types.
> This behavior is by design, as camel supports deep models, spread over
> multiple files (see AnnotationModelLoader.loadModels() implementation where
> whole packages are scanned).
> The documentation is rather vague, but I believe supporting multiple models
> in the same package is not really feasible, and overkill at best. Therefore
> my preference would be to keep the functionality as is and document the
> limitation.
> Currently the BindyCVSFieldEndingWithSeparatorIssueTest fails due to a
> conflict between MyCsvRecord.class and
> BindyDoubleQuotesCsvUnmarshallTest.Order.class defined in the same package.
> Moving MyCsvRecord to a different package is a trivial fix. I will look into
> adding some model validation as well to WARN if the model is inconsistent
> (i.e. has overlaps or gaps).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira