Reputation: 11
I am using univocity-parser library for this
class Person{
@Parsed(index=1)
String name;
@Parsed(index=2)
String age;
Address address;
}
class Address{
@Parsed(index=3)
String street;
String city;
}
BeanListProcessor rowProcessor = new BeanListProcessor(Person.class);
List beans = rowProcessor.getBeans();
Exception while mapping the csv columns to POJO class : com.univocity.parsers.common.DataProcessingException: Unable to set value to address field
Is there any other way to do it
Upvotes: 1
Views: 313
Reputation: 6289
Use the @Nested
annotation introduced in version 2.4.0, just do this:
class Person{
@Parsed(index=1)
String name;
@Parsed(index=2)
String age;
@Nested
Address address;
}
Upvotes: 1