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

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

@jrjena136

Description

@jrjena136

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions