本文整理匯總了Java中com.fasterxml.jackson.annotation.JsonInclude.Include.ALWAYS屬性的典型用法代碼示例。如果您正苦於以下問題:Java Include.ALWAYS屬性的具體用法?Java Include.ALWAYS怎麽用?Java Include.ALWAYS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.fasterxml.jackson.annotation.JsonInclude.Include
的用法示例。
在下文中一共展示了Include.ALWAYS屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testSimpleMerge
public void testSimpleMerge()
{
JsonInclude.Value empty = JsonInclude.Value.empty();
assertEquals(Include.USE_DEFAULTS, empty.getValueInclusion());
assertEquals(Include.USE_DEFAULTS, empty.getContentInclusion());
JsonInclude.Value v2 = empty.withValueInclusion(Include.NON_ABSENT);
assertEquals(Include.NON_ABSENT, v2.getValueInclusion());
assertEquals(Include.USE_DEFAULTS, v2.getContentInclusion());
JsonInclude.Value v3 = new JsonInclude.Value(Include.NON_EMPTY, Include.ALWAYS,
null, null);
assertEquals(Include.NON_EMPTY, v3.getValueInclusion());
assertEquals(Include.ALWAYS, v3.getContentInclusion());
// Ok; but then overrides, which should skip 'USE_DEFAULT' overrides
JsonInclude.Value merged = v3.withOverrides(empty);
// no overrides with "empty":
assertEquals(v3.getValueInclusion(), merged.getValueInclusion());
assertEquals(v3.getContentInclusion(), merged.getContentInclusion());
// but other values ought to be overridden (value, yes, content, no because it's default)
merged = JsonInclude.Value.merge(v3, v2);
assertEquals(v2.getValueInclusion(), merged.getValueInclusion());
assertEquals(v3.getContentInclusion(), merged.getContentInclusion());
merged = JsonInclude.Value.mergeAll(empty, v3);
assertEquals(v3.getValueInclusion(), merged.getValueInclusion());
assertEquals(v3.getContentInclusion(), merged.getContentInclusion());
}
示例2: JsonMapper
public JsonMapper() {
this(Include.ALWAYS);
}