42BV / CSVeed

Light-weight, easy-to-use Java-based CSV utility

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Handling of null/empty values could be improved

hvennekate opened this issue · comments

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.

@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));