杰克逊:JsonInclude如何添加多个JsonInclude注释类型 [英] Jackson: JsonInclude how to add Multiple JsonInclude annotation type
本文介绍了杰克逊:JsonInclude如何添加多个JsonInclude注释类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何告诉类仅包含NON_EMPTY和NON_NULL值, 使用
How can I tell a class to include only NON_EMPTY and NON_NULL values only, Using
@JsonInclude(Include.NON_NULL)
@JsonInclude(Include.NON_EMPTY)
public class foo{
String a;
}
抛出重复注释错误.
推荐答案
"Null is always considered empty" - Jackson's site
因此NON_EMPTY规则涵盖了这两种情况.
So the NON_EMPTY rule covers both cases..
这篇关于杰克逊:JsonInclude如何添加多个JsonInclude注释类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文