Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

MappingStrategy.ignoreFields() does not work properly. #9

Open
jrjena136 opened this issue Feb 24, 2020 · 0 comments
Open

MappingStrategy.ignoreFields() does not work properly. #9

jrjena136 opened this issue Feb 24, 2020 · 0 comments

Comments

@jrjena136
Copy link

I have different beans which I used while writing data to CSV. I have extended the ColumnPositionMappingStrategy class and customized the mapping strategy. I have annotated all my beans with @CsvBindByName and @CsvBindByPosition. Everytihing is working fine till now. Now the problem arises when I try to ignore some of the bean fields based on some condition. Those fields are not coming as part of CSV when my condition satisfies but the csv file contains the empty column. How can I solve this problem. Please help if possible.

As per opencsv 5.1 we can use MappingStrategy.ignoreFields() if we want to ignore some fields and also it is mentioned that it must be used before mappingStrategy.setType(). I have used it same way but I could see empty columns in my generated CSV file.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant