Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inject ReadProcessor #16

Open
ritonglue opened this issue Jul 25, 2022 · 1 comment
Open

Inject ReadProcessor #16

ritonglue opened this issue Jul 25, 2022 · 1 comment

Comments

@ritonglue
Copy link

It would be interesting to use a customize ReadProcessor and be able to read the full CSVRecord before processing. This is usefull if you have a ragged csv file and you want to skip some lines. A solution is to modify the private method getCSVRecord to
protected T getCSVRecord(CSVRecord record, Map<Integer, CSVReadAnnotationManager> map) throws InstantiationException, IllegalAccessException
and inject its own ReadProcessor to the CSVProcessor. Two solutions :

  • either create a public method getReadProcessor() in CSVProcessor and use it instead of the field readProcessor
  • or inject it via constructor.

The CSVNamedReadProcessor and the CSVOrderReadProcessor must be extendable (they must be public) as one wants to override their getCSVRecord method.

@bpoole6
Copy link
Owner

bpoole6 commented Aug 1, 2022

Not a bad idea to allow for that level of extensibility. If that were to be added I would want that to be a first class implementation instead of possible workaround just incase the inner class methods get moved around or renamed.

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

No branches or pull requests

2 participants