OpenCSV Java - CsvToBeanFilter 使用带注释的对象而不是 HeaderColumnNameTranslateMappingStrategy
OpenCSV Java - CsvToBeanFilter using annotated objects instead of a HeaderColumnNameTranslateMappingStrategy
我正在读取 CSV 文件并使用 HeaderColumnNameTranslateMappingStrategy
将我的对象中的列与输入数据中的列相关联,一切正常。
另外,我实现了一个 CsvToBeanFilter
来在构造对象之前过滤掉数据以提高性能。
我想做的是从 HeaderColumnNameTranslateMappingStrategy
转移到对象上的注释字段。
然而,CsvToBeanFilter
的 provided example 似乎指的是 MappingStrategy
以获取对象外部的列。
关于如何使用带注释的字段执行此操作的任何想法?
事实上 the supplied documentation doesn't compile, and references a deprecated method 让我觉得我可能运气不好。
交叉发布from the bug report I filed。
Yeah, you've caught us at an inopertune moment. I became aware of that
use for getColumnIndex() after I deprecated it, and the replacement
for CsvToBeanFilter (BeanVerifier) is in master, but hasn't been
released yet. Right now, just use the deprecated getColumnIndex() if
you have to. It should be very easy to move from CsvToBeanFilter to
BeanVerifier once 4.4 is released.
I'll take care of the documentation error another time, but thanks
very much for pointing it out. I believe in flawless documentation.
我正在读取 CSV 文件并使用 HeaderColumnNameTranslateMappingStrategy
将我的对象中的列与输入数据中的列相关联,一切正常。
另外,我实现了一个 CsvToBeanFilter
来在构造对象之前过滤掉数据以提高性能。
我想做的是从 HeaderColumnNameTranslateMappingStrategy
转移到对象上的注释字段。
然而,CsvToBeanFilter
的 provided example 似乎指的是 MappingStrategy
以获取对象外部的列。
关于如何使用带注释的字段执行此操作的任何想法?
事实上 the supplied documentation doesn't compile, and references a deprecated method 让我觉得我可能运气不好。
交叉发布from the bug report I filed。
Yeah, you've caught us at an inopertune moment. I became aware of that use for getColumnIndex() after I deprecated it, and the replacement for CsvToBeanFilter (BeanVerifier) is in master, but hasn't been released yet. Right now, just use the deprecated getColumnIndex() if you have to. It should be very easy to move from CsvToBeanFilter to BeanVerifier once 4.4 is released.
I'll take care of the documentation error another time, but thanks very much for pointing it out. I believe in flawless documentation.