Class JsonInclude.Value
- java.lang.Object
-
- com.fasterxml.jackson.annotation.JsonInclude.Value
-
- All Implemented Interfaces:
JacksonAnnotationValue<JsonInclude>,java.io.Serializable
- Enclosing class:
- JsonInclude
public static class JsonInclude.Value extends java.lang.Object implements JacksonAnnotationValue<JsonInclude>, java.io.Serializable
Helper class used to contain information from a singleJsonIncludeannotation.- Since:
- 2.6
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Class<?>_contentFilterprotected JsonInclude.Include_contentInclusionprotected java.lang.Class<?>_valueFilterprotected JsonInclude.Include_valueInclusionstatic JsonInclude.ValueALL_ALWAYSConstant that indicates that property is to be always included, independent of value of the property.static JsonInclude.ValueALL_NON_ABSENTConstant that indicates that properties are included unless their value is: null "absent" value of a referential type (like Java 8 `Optional`, orAtomicReference); that is, something that would not deference to a non-null value.static JsonInclude.ValueALL_NON_DEFAULTThe equivalent toJsonInclude.Include.NON_DEFAULTfor specifying inclusion of non-defaults for both values and content.static JsonInclude.ValueALL_NON_EMPTYConstant that indicates that only properties with null value, or what is considered empty, are not to be included.static JsonInclude.ValueALL_NON_NULLConstant that indicates that only properties with non-null values are to be included.protected static JsonInclude.ValueEMPTY
-
Constructor Summary
Constructors Modifier Constructor Description Value(JsonInclude src)protectedValue(JsonInclude.Include vi, JsonInclude.Include ci, java.lang.Class<?> valueFilter, java.lang.Class<?> contentFilter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JsonInclude.Valueconstruct(JsonInclude.Include valueIncl, JsonInclude.Include contentIncl)Factory method to use for constructing an instance for componentsstatic JsonInclude.Valueconstruct(JsonInclude.Include valueIncl, JsonInclude.Include contentIncl, java.lang.Class<?> valueFilter, java.lang.Class<?> contentFilter)Factory method to use for constructing an instance for componentsstatic JsonInclude.Valueempty()booleanequals(java.lang.Object o)static JsonInclude.Valuefrom(JsonInclude src)Factory method to use for constructing an instance from instance ofJsonIncludejava.lang.Class<?>getContentFilter()JsonInclude.IncludegetContentInclusion()java.lang.Class<?>getValueFilter()JsonInclude.IncludegetValueInclusion()inthashCode()static JsonInclude.Valuemerge(JsonInclude.Value base, JsonInclude.Value overrides)Helper method that will try to combine values from twoJsonInclude.Valueinstances, using one as base settings, and the other as overrides to use instead of base values when defined; base values are only use if override does not specify a value (matching value is null or logically missing).static JsonInclude.ValuemergeAll(JsonInclude.Value... values)protected java.lang.ObjectreadResolve()java.lang.StringtoString()java.lang.Class<JsonInclude>valueFor()Introspection method that may be used to find actual annotation that may be used as the source for value instance.JsonInclude.ValuewithContentFilter(java.lang.Class<?> filter)Mutant factory that will either SetcontentasUSE_DEFAULTSandcontentFiltertofilter(if filter not null); or SetcontentasALWAYS(if filter null)JsonInclude.ValuewithContentInclusion(JsonInclude.Include incl)JsonInclude.ValuewithOverrides(JsonInclude.Value overrides)Mutant factory method that merges values of this value with given override values, so that any explicitly defined inclusion in overrides has precedence over settings of this value instance.JsonInclude.ValuewithValueFilter(java.lang.Class<?> filter)Mutant factory that will either SetvalueasUSE_DEFAULTSandvalueFiltertofilter(if filter not null); or SetvalueasALWAYS(if filter null)JsonInclude.ValuewithValueInclusion(JsonInclude.Include incl)
-
-
-
Field Detail
-
ALL_ALWAYS
public static final JsonInclude.Value ALL_ALWAYS
Constant that indicates that property is to be always included, independent of value of the property.This will specify the same setting for including a value both on Java object level as well as when contained in an object reference (see
JsonIncludefor further details on this distinction).- Since:
- 2.21
-
ALL_NON_NULL
public static final JsonInclude.Value ALL_NON_NULL
Constant that indicates that only properties with non-null values are to be included.This will specify the same setting for including a value both on Java object level as well as when contained in an object reference (see
JsonIncludefor further details on this distinction).- Since:
- 2.21
-
ALL_NON_ABSENT
public static final JsonInclude.Value ALL_NON_ABSENT
Constant that indicates that properties are included unless their value is:- null
- "absent" value of a referential type (like Java 8 `Optional`, or
AtomicReference); that is, something that would not deference to a non-null value.
This will specify the same setting for including a value both on Java object level as well as when contained in an object reference (see
JsonIncludefor further details on this distinction).- Since:
- 2.21
-
ALL_NON_EMPTY
public static final JsonInclude.Value ALL_NON_EMPTY
Constant that indicates that only properties with null value, or what is considered empty, are not to be included. SeeJsonInclude.Include.NON_EMPTYfor further details.This will specify the same setting for including a value both on Java object level as well as when contained in an object reference (see
JsonIncludefor further details on this distinction).- Since:
- 2.21
-
ALL_NON_DEFAULT
public static final JsonInclude.Value ALL_NON_DEFAULT
The equivalent toJsonInclude.Include.NON_DEFAULTfor specifying inclusion of non-defaults for both values and content.This will specify the same setting for including a value both on Java object level as well as when contained in an object reference (see
JsonIncludefor further details on this distinction).- Since:
- 2.21
-
EMPTY
protected static final JsonInclude.Value EMPTY
-
_valueInclusion
protected final JsonInclude.Include _valueInclusion
-
_contentInclusion
protected final JsonInclude.Include _contentInclusion
-
_valueFilter
protected final java.lang.Class<?> _valueFilter
- Since:
- 2.9
-
_contentFilter
protected final java.lang.Class<?> _contentFilter
- Since:
- 2.9
-
-
Constructor Detail
-
Value
public Value(JsonInclude src)
-
Value
protected Value(JsonInclude.Include vi, JsonInclude.Include ci, java.lang.Class<?> valueFilter, java.lang.Class<?> contentFilter)
-
-
Method Detail
-
empty
public static JsonInclude.Value empty()
-
merge
public static JsonInclude.Value merge(JsonInclude.Value base, JsonInclude.Value overrides)
Helper method that will try to combine values from twoJsonInclude.Valueinstances, using one as base settings, and the other as overrides to use instead of base values when defined; base values are only use if override does not specify a value (matching value is null or logically missing). Note that one or both of value instances may be `null`, directly; if both are `null`, result will also be `null`; otherwise never null.- Since:
- 2.8
-
mergeAll
public static JsonInclude.Value mergeAll(JsonInclude.Value... values)
- Since:
- 2.8
-
readResolve
protected java.lang.Object readResolve()
-
withOverrides
public JsonInclude.Value withOverrides(JsonInclude.Value overrides)
Mutant factory method that merges values of this value with given override values, so that any explicitly defined inclusion in overrides has precedence over settings of this value instance. If no overrides exist will returnthisinstance; otherwise newJsonInclude.Valuewith changed inclusion values.
-
construct
public static JsonInclude.Value construct(JsonInclude.Include valueIncl, JsonInclude.Include contentIncl)
Factory method to use for constructing an instance for components
-
construct
public static JsonInclude.Value construct(JsonInclude.Include valueIncl, JsonInclude.Include contentIncl, java.lang.Class<?> valueFilter, java.lang.Class<?> contentFilter)
Factory method to use for constructing an instance for components- Since:
- 2.9
-
from
public static JsonInclude.Value from(JsonInclude src)
Factory method to use for constructing an instance from instance ofJsonInclude
-
withValueInclusion
public JsonInclude.Value withValueInclusion(JsonInclude.Include incl)
-
withValueFilter
public JsonInclude.Value withValueFilter(java.lang.Class<?> filter)
Mutant factory that will either- Set
valueasUSE_DEFAULTSandvalueFiltertofilter(if filter not null); or - Set
valueasALWAYS(if filter null)
- Since:
- 2.9
- Set
-
withContentFilter
public JsonInclude.Value withContentFilter(java.lang.Class<?> filter)
Mutant factory that will either- Set
contentasUSE_DEFAULTSandcontentFiltertofilter(if filter not null); or - Set
contentasALWAYS(if filter null)
- Since:
- 2.9
- Set
-
withContentInclusion
public JsonInclude.Value withContentInclusion(JsonInclude.Include incl)
-
valueFor
public java.lang.Class<JsonInclude> valueFor()
Description copied from interface:JacksonAnnotationValueIntrospection method that may be used to find actual annotation that may be used as the source for value instance.- Specified by:
valueForin interfaceJacksonAnnotationValue<JsonInclude>- Returns:
- Annotation class for which instances of this value class are created
-
getValueInclusion
public JsonInclude.Include getValueInclusion()
-
getContentInclusion
public JsonInclude.Include getContentInclusion()
-
getValueFilter
public java.lang.Class<?> getValueFilter()
-
getContentFilter
public java.lang.Class<?> getContentFilter()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
-