Class JsonInclude.Value
- All Implemented Interfaces:
JacksonAnnotationValue<JsonInclude>,Serializable
- Enclosing class:
JsonInclude
JsonInclude
annotation.- Since:
- 2.6
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Class<?> protected final JsonInclude.Includeprotected final Class<?> protected final JsonInclude.Includestatic final JsonInclude.ValueConstant that indicates that property is to be always included, independent of value of the property.static final JsonInclude.ValueConstant 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 final JsonInclude.ValueThe equivalent toJsonInclude.Include.NON_DEFAULTfor specifying inclusion of non-defaults for both values and content.static final JsonInclude.ValueConstant that indicates that only properties with null value, or what is considered empty, are not to be included.static final JsonInclude.ValueConstant that indicates that only properties with non-null values are to be included.protected static final JsonInclude.Value -
Constructor Summary
ConstructorsModifierConstructorDescriptionValue(JsonInclude src) protectedValue(JsonInclude.Include vi, JsonInclude.Include ci, Class<?> valueFilter, Class<?> contentFilter) -
Method Summary
Modifier and TypeMethodDescriptionstatic 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, Class<?> valueFilter, Class<?> contentFilter) Factory method to use for constructing an instance for componentsstatic JsonInclude.Valueempty()booleanstatic JsonInclude.Valuefrom(JsonInclude src) Factory method to use for constructing an instance from instance ofJsonIncludeClass<?> Class<?> 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 ObjecttoString()valueFor()Introspection method that may be used to find actual annotation that may be used as the source for value instance.withContentFilter(Class<?> filter) Mutant factory that will either SetcontentasUSE_DEFAULTSandcontentFiltertofilter(if filter not null); or SetcontentasALWAYS(if filter null)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.withValueFilter(Class<?> filter) Mutant factory that will either SetvalueasUSE_DEFAULTSandvalueFiltertofilter(if filter not null); or SetvalueasALWAYS(if filter null)
-
Field Details
-
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
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
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
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
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
-
_valueInclusion
-
_contentInclusion
-
_valueFilter
- Since:
- 2.9
-
_contentFilter
- Since:
- 2.9
-
-
Constructor Details
-
Value
-
Value
protected Value(JsonInclude.Include vi, JsonInclude.Include ci, Class<?> valueFilter, Class<?> contentFilter)
-
-
Method Details
-
empty
-
merge
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
- Since:
- 2.8
-
readResolve
-
withOverrides
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, Class<?> valueFilter, Class<?> contentFilter) Factory method to use for constructing an instance for components- Since:
- 2.9
-
from
Factory method to use for constructing an instance from instance ofJsonInclude -
withValueInclusion
-
withValueFilter
Mutant factory that will either- Set
valueasUSE_DEFAULTSandvalueFiltertofilter(if filter not null); or - Set
valueasALWAYS(if filter null)
- Since:
- 2.9
- Set
-
withContentFilter
Mutant factory that will either- Set
contentasUSE_DEFAULTSandcontentFiltertofilter(if filter not null); or - Set
contentasALWAYS(if filter null)
- Since:
- 2.9
- Set
-
withContentInclusion
-
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
-
getContentInclusion
-
getValueFilter
-
getContentFilter
-
toString
-
hashCode
public int hashCode() -
equals
-