Class JsonInclude.Value

    • 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 JsonInclude for 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 JsonInclude for 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 option is mostly used to work with "Optional"s (Java 8, Guava).

        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 JsonInclude for 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. See JsonInclude.Include.NON_EMPTY for 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 JsonInclude for further details on this distinction).

        Since:
        2.21
      • ALL_NON_DEFAULT

        public static final JsonInclude.Value ALL_NON_DEFAULT
        The equivalent to JsonInclude.Include.NON_DEFAULT for 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 JsonInclude for further details on this distinction).

        Since:
        2.21
      • _valueFilter

        protected final java.lang.Class<?> _valueFilter
        Since:
        2.9
      • _contentFilter

        protected final java.lang.Class<?> _contentFilter
        Since:
        2.9
    • Method Detail

      • merge

        public static JsonInclude.Value merge​(JsonInclude.Value base,
                                              JsonInclude.Value overrides)
        Helper method that will try to combine values from two JsonInclude.Value instances, 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
      • 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 return this instance; otherwise new JsonInclude.Value with changed inclusion values.
      • withValueFilter

        public JsonInclude.Value withValueFilter​(java.lang.Class<?> filter)
        Mutant factory that will either
        • Set value as USE_DEFAULTS and valueFilter to filter (if filter not null); or
        • Set value as ALWAYS (if filter null)
        Since:
        2.9
      • withContentFilter

        public JsonInclude.Value withContentFilter​(java.lang.Class<?> filter)
        Mutant factory that will either
        • Set content as USE_DEFAULTS and contentFilter to filter (if filter not null); or
        • Set content as ALWAYS (if filter null)
        Since:
        2.9
      • valueFor

        public java.lang.Class<JsonInclude> valueFor()
        Description copied from interface: JacksonAnnotationValue
        Introspection method that may be used to find actual annotation that may be used as the source for value instance.
        Specified by:
        valueFor in interface JacksonAnnotationValue<JsonInclude>
        Returns:
        Annotation class for which instances of this value class are created
      • getValueFilter

        public java.lang.Class<?> getValueFilter()
      • getContentFilter

        public java.lang.Class<?> getContentFilter()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object