JsonInclude.Value (Jackson-annotations 2.14.0 API)

com.fasterxml.jackson.annotation

## Class JsonInclude.Value

- java.lang.Object
- - com.fasterxml.jackson.annotation.JsonInclude.Value

- All Implemented Interfaces:
    JacksonAnnotationValue<JsonInclude>, Serializable
  Enclosing class:
    JsonInclude

      public static class JsonInclude.Value
      extends Object
      implements JacksonAnnotationValue<JsonInclude>, Serializable

  Helper class used to contain information from a single `JsonInclude` annotation.
  Since:
    2.6
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Class<?>` | `_contentFilter`
    `protected JsonInclude.Include` | `_contentInclusion`
    `protected Class<?>` | `_valueFilter`
    `protected JsonInclude.Include` | `_valueInclusion`
    `protected static JsonInclude.Value` | `EMPTY`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `Value(JsonInclude.Include vi, JsonInclude.Include ci, Class<?> valueFilter, Class<?> contentFilter)`
    `` | `Value(JsonInclude src)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static JsonInclude.Value` | `construct(JsonInclude.Include valueIncl, JsonInclude.Include contentIncl)` Factory method to use for constructing an instance for components
    `static JsonInclude.Value` | `construct(JsonInclude.Include valueIncl, JsonInclude.Include contentIncl, Class<?> valueFilter, Class<?> contentFilter)` Factory method to use for constructing an instance for components
    `static JsonInclude.Value` | `empty()`
    `boolean` | `equals(Object o)`
    `static JsonInclude.Value` | `from(JsonInclude src)` Factory method to use for constructing an instance from instance of `JsonInclude`
    `Class<?>` | `getContentFilter()`
    `JsonInclude.Include` | `getContentInclusion()`
    `Class<?>` | `getValueFilter()`
    `JsonInclude.Include` | `getValueInclusion()`
    `int` | `hashCode()`
    `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).
    `static JsonInclude.Value` | `mergeAll(JsonInclude.Value... values)`
    `protected Object` | `readResolve()`
    `String` | `toString()`
    `Class<JsonInclude>` | `valueFor()` Introspection method that may be used to find actual annotation that may be used as the source for value instance.
    `JsonInclude.Value` | `withContentFilter(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)
    `JsonInclude.Value` | `withContentInclusion(JsonInclude.Include incl)`
    `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.
    `JsonInclude.Value` | `withValueFilter(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)
    `JsonInclude.Value` | `withValueInclusion(JsonInclude.Include incl)`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### EMPTY

          protected static final JsonInclude.Value EMPTY

    - #### _valueInclusion

          protected final JsonInclude.Include _valueInclusion

    - #### _contentInclusion

          protected final JsonInclude.Include _contentInclusion

    - #### _valueFilter

          protected final Class<?> _valueFilter

      Since:
        2.9

    - #### _contentFilter

          protected final Class<?> _contentFilter

      Since:
        2.9

  - ### Constructor Detail

    - #### Value

          public Value(JsonInclude src)

    - #### Value

          protected Value(JsonInclude.Include vi,
                          JsonInclude.Include ci,
                          Class<?> valueFilter,
                          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 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

    - #### mergeAll

          public static JsonInclude.Value mergeAll(JsonInclude.Value... values)

      Since:
        2.8

    - #### readResolve

          protected 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.

    - #### 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

          public static JsonInclude.Value from(JsonInclude src)

      Factory method to use for constructing an instance from instance of `JsonInclude`

    - #### withValueInclusion

          public JsonInclude.Value withValueInclusion(JsonInclude.Include incl)

    - #### withValueFilter

          public JsonInclude.Value withValueFilter(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(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

    - #### withContentInclusion

          public JsonInclude.Value withContentInclusion(JsonInclude.Include incl)

    - #### valueFor

          public 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

    - #### getValueInclusion

          public JsonInclude.Include getValueInclusion()

    - #### getContentInclusion

          public JsonInclude.Include getContentInclusion()

    - #### getValueFilter

          public Class<?> getValueFilter()

    - #### getContentFilter

          public Class<?> getContentFilter()

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

Copyright © 2008–2022 FasterXML. All rights reserved.