Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-18512

Camel Bindy, marshaling CSV with more fields than Model

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.18.2
    • Future
    • camel-bindy
    • None
    • Unknown

    Description

      Our project has a use-case for Bindy where we would like to define a Model POJO that has less fields than the resulting CSV would have. We tried to achieve this by defining a model with the proper annotations and using the "pos" parameter in the DataField annotations.

      For example you might want to define one field at position 4 and another at position 6. The resulting CSV should then contain an empty field at position 5. We used BeanIO previously and it supported this use-case. Adding dummy fields is fine in simple cases but when a CSV exceeds 100 fields, of which a couple dozen are used, it becomes very cumbersome to handle.

      Specifically the unmarshal obviously works fine, but we are trying to marshal in this case. We are transitioning to using Bindy for all CSV handling and ran into this problem. I believe this would be useful generally.

      Sample project that illustrates this case: https://github.com/jwwallin/bindy-csv-sample 

      Attachments

        Activity

          People

            Unassigned Unassigned
            jwwallin Jussi Wallin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: