我正在尝试将Provider
类型的对象转换为Client
类型,以便最好使用Jackson ObjectMapper
跟随以下Java类。这里的字段数(派生的字段)和层次结构不匹配。
Class Address_Client {
String line1;
String line2;
}
Class Student_Client {
private String name;
private Address_Client address;
}
abstract Class Base_Client {
private Student_Client student;
private byte[] payload;
}
Class Client extends Base_Client{
StudentRecord_Client studentRecord; //deserialized value of Base_A.payload
}
Class StudentRecord_Client {
String id1;
String id2;
}
Class Student_Provider {
private String name;
private String addressLine1;
private String addressLine2;
}
Class Provider {
Student_Provider student;
private byte[] payload
}
我需要将Provider对象转换为Client对象。
我尝试使用@jsonProperty,但无法通过它解决。