I was trying to use the annotation MapToColumn in my User class.
But it didn't work and I had troubles figuring out why.
Eventually I did, only by reading the code, in particular
`AnnotationEntryParser#fillObject`.
The problem is that I have a hierarchy Actor <= User
with some annotated fields in the superclass and some in the subclass.
And it turns out that #fillObject uses `entry.getClass().getDeclaredFields()`
which does not access fields in superclasses.
Fair enough to me, as I see that #getFields can access fields in superclasses
but only public ones.
So, I think this just needs to be clarified in the wiki page:
https://code.google.com/p/jcsv/wiki/CSVReader#Create_Java_objects_using_annotati
ons
Btw, I/m on v1.4.0.
Thx
AS
Example
-------
public class AnnotatedPerson {
@MapToColumn(column=0)
protected String firstname;
@MapToColumn(column=1)
protected String lastname;
@Override
public String toString() {
return String.format("%s %s years", firstname, lastname);
}
public class Employee extends AnnotatedPerson {
@MapToColumn(column=2)
private int age;
@Override
public String toString() {
return super.toString() + " " + age;
}
}
Original issue reported on code.google.com by scotto.a...@gmail.com on 11 Jun 2014 at 11:37
Original issue reported on code.google.com by
scotto.a...@gmail.com
on 11 Jun 2014 at 11:37