我有一个嵌套的POJO结构定义,类似于这样:
public class Employee {
private String id;
private Personal personal;
private Official official;
}
public class Personal {
private String fName;
private String lName;
private String address;
}
public class Official {
private boolean active;
private Salary salary;
}
public class Salary {
private double hourly;
private double monthly;
private double yearly;
}
我从一个带有点注释的服务中获取更新,以了解哪些值发生了改变,例如,
id change --> id=100
address change --> personal.address=123 Main Street
hourly salary change --> official.salary.hourly=100
这个POJO结构可能会有3-4层深度。我需要查找这个传入的变化值并更新POJO中相应的值。做到最好的方法是什么?