Menu

#116 HeaderColumnNameTranslateMappingStrategy useless while writing with BeanToCsv

v1.0 (example)
closed-rejected
2
2015-08-25
2015-07-12
Andre Ziehn
No

As already mentioned by another user 4 years ago within this ticket: https://sourceforge.net/p/opencsv/patches/32/ the HeaderColumnNameTranslateMappingStrategy is useless while writing a csv file with BeanToCsv. The header will always be written exactly like the field names of the bean and not like the mapping names from the strategy.
I helped myself by overwriting the BeanToCsv#processHeader method and return a String[] of my custom header.
In my opinion this should be done implicitly by the mapping names from the HeaderColumnNameTranslateMappingStrategy.

Discussion

  • Scott Conway

    Scott Conway - 2015-08-25

    Sorry I forgot to close this down when I closed down the patch as well. If this really bugs you then please send the patch as a new class instead of changing the expected behavior of an existing class. Just also make sure the class has tests that shows the difference between your class and the existing HeaderColumnNameTranslateMappingStrategy (and performs the same functionality).

     
  • Scott Conway

    Scott Conway - 2015-08-25
    • status: open --> closed-rejected
    • Priority: 8 --> 2
     

Log in to post a comment.