我正在使用Jackson 2从JSON进行转换,我使用的是无法干扰的应用程序代码(Tacton Software)。在那里,我有一个类似的课程:
public class Quotation {
private Reference currency; // This type does not have deafult constructor
private List<QuotationItem> quotationItems = new ArrayList(); // In this there are abstract fields
// Getters, setters and other fields omitted for clarity
}
所以基本上我已经尝试过扩展Quotation类了:
class JSONQuotation extends Quotation{
@JsonSetter("currency")
public void notSetCurrency(JSONReference ref){
this.setCurrency(null);
}
@JsonSetter("items")
@Override
public void setItems (List<QuotationItem> item){
}
}
所以我使用了两种类型的注释:
无论如何我仍然从ObjectMapper中得到错误,当然,我已经设置了MixIns
mapper.addMixIn(Quotation.class,JSONQuotation.class);
任何人都可以帮我这个或推荐一些其他解串器?