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

Handling of null/empty values could be improved #118

Open
hvennekate opened this issue Mar 9, 2020 · 1 comment
Open

Handling of null/empty values could be improved #118

hvennekate opened this issue Mar 9, 2020 · 1 comment

Comments

@hvennekate
Copy link

https://github.com/robert-bor/CSVeed/blob/31d23f728e7a4b09aa91d5c443c3fc8f5067d428/src/main/java/org/csveed/bean/conversion/BeanWrapper.java#L39

This choice appears unreasonable from the user's perspective: it is not possible to customize the behavior as the converter does not get called. At the same time, any previously initialized value gets overwritten.
Please either do not touch the existing value (from field initialization) or offer some hook into this process such that null and empty values can be mapped to some reasonable default.

@hazendaz
Copy link
Collaborator

hazendaz commented Jun 12, 2023

@hvennekate Know this is old but are you saying it should be something like this?

Current

 writeMethod.invoke(bean, value == null || value.equals("") ? null : converter.fromString(value));

New

 writeMethod.invoke(bean, converter.fromString(value));

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