为此,我使用了univocity-parser库
班级人员{
@Parsed(index=1)
字符串名称;
@Parsed(index=2)
字符串年龄;
地址地址;
}
类地址{
@Parsed(index=3)
弦街;
字符串城市;
}
BeanListProcessor rowProcessor =新的BeanListProcessor(Person.class);
列表beans = rowProcessor.getBeans();
将csv列映射到POJO类时出现异常: com.univocity.parsers.common.DataProcessingException:无法设置地址字段的值
有没有别的办法呢?
发布于 2017-03-15 02:44:31
使用2.4.0版中引入的@Nested
注释,只需执行以下操作:
class Person{
@Parsed(index=1)
String name;
@Parsed(index=2)
String age;
@Nested
Address address;
}
https://stackoverflow.com/questions/42386513
复制相似问题