我正在使用univocity-parser库
班级人{
@parsed(index = 1)
字符串名称;
@parsed(index = 2)
字符串年龄;
地址地址;
}
类地址{
@parsed(index = 3)
弦街;
字符串城市;
}
beanlistProcessor rowProcessor = new BeanListProcessor(Person.Class);
list beans = rowprocessor.getBeans();
在将CSV列映射到POJO类时的例外:com.univocity.parsers.common.dataprocessingexception:无法将值设置为地址字段
还有其他方法
使用版本2.4.0中引入的@Nested
注释,只需这样做:
class Person{
@Parsed(index=1)
String name;
@Parsed(index=2)
String age;
@Nested
Address address;
}