更新时间:2023-11-05 19:38:46
确定。找到了答案。
所有需要做的就是在派生类中创建一个setter方法,例如
Ok. Found the answer. All that needs to be done is to create a setter method in the derived class such as
@XmlElement(name = "newField1")
public void setField1(String field1) {
this.field1 = field1;
}
Ofc,这假设您正在访问的字段具有受保护的访问权限基类。否则你可能需要稍微肮脏并做一些反思;)
Ofc, this assumes that the field that you are accessing has protected access in the base class. Else you might need to get a little dirty and do some reflection ;)