I had the following class.
class SimpleDate {
private final int year;
private final int month;
private final int date;
}
Now I plan to override the class.
class SimpleDate {
private final int year;
private final int month;
private final int day;
}
To solve the problem of renaming variables, I will use an alias.
xStream.aliasField("date", SimpleDate.class, "day");
However, how can I find out that I am reading the old XML file and I will add +1 for the new month of reading field to change it from 0 to 1 based on 1?
source
share