com.fasterxml.jackson.databind

## Class PropertyMetadata

- java.lang.Object
- - com.fasterxml.jackson.databind.PropertyMetadata

- All Implemented Interfaces:
    Serializable

      public class PropertyMetadata
      extends Object
      implements Serializable

  Simple container class used for storing "additional" metadata about properties. Carved out to reduce number of distinct properties that actual property implementations and place holders need to store; since instances are immutable, they can be freely shared.
  Since:
    2.3
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `PropertyMetadata.MergeInfo` Helper class used for containing information about expected merge information for this property, if merging is expected.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Nulls` | `_contentNulls` Settings regarding handling of incoming `null`s, both for value itself and, for structured types, content values (array/Collection elements, Map values).
    `protected String` | `_defaultValue` Optional default value, as String, for property; not used for any functionality by core databind, offered as metadata for extensions.
    `protected String` | `_description` Optional human-readable description associated with the property.
    `protected Integer` | `_index` Optional index of the property within containing Object.
    `protected PropertyMetadata.MergeInfo` | `_mergeInfo` Settings regarding merging, if property is determined to possibly be mergeable (possibly since global settings may be omitted for non-mergeable types).
    `protected Boolean` | `_required` Three states: required, not required and unknown; unknown represented as null.
    `protected Nulls` | `_valueNulls` Settings regarding handling of incoming `null`s, both for value itself and, for structured types, content values (array/Collection elements, Map values).
    `static PropertyMetadata` | `STD_OPTIONAL`
    `static PropertyMetadata` | `STD_REQUIRED`
    `static PropertyMetadata` | `STD_REQUIRED_OR_OPTIONAL`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `PropertyMetadata(Boolean req, String desc, Integer index, String def, PropertyMetadata.MergeInfo mergeInfo, Nulls valueNulls, Nulls contentNulls)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static PropertyMetadata` | `construct(boolean req, String desc, Integer index, String defaultValue)` Deprecated.
    `static PropertyMetadata` | `construct(Boolean req, String desc, Integer index, String defaultValue)`
    `Nulls` | `getContentNulls()`
    `String` | `getDefaultValue()`
    `String` | `getDescription()`
    `Integer` | `getIndex()`
    `PropertyMetadata.MergeInfo` | `getMergeInfo()`
    `Boolean` | `getRequired()`
    `Nulls` | `getValueNulls()`
    `boolean` | `hasDefaultValue()` Accessor for determining whether property has declared "default value", which may be used by extension modules.
    `boolean` | `hasIndex()`
    `boolean` | `isRequired()`
    `protected Object` | `readResolve()` Minor optimization: let's canonicalize back to placeholders in cases where there is no real data to consider
    `PropertyMetadata` | `withDefaultValue(String def)`
    `PropertyMetadata` | `withDescription(String desc)`
    `PropertyMetadata` | `withIndex(Integer index)`
    `PropertyMetadata` | `withMergeInfo(PropertyMetadata.MergeInfo mergeInfo)`
    `PropertyMetadata` | `withNulls(Nulls valueNulls, Nulls contentNulls)`
    `PropertyMetadata` | `withRequired(Boolean b)`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### STD_REQUIRED

          public static final PropertyMetadata STD_REQUIRED

    - #### STD_OPTIONAL

          public static final PropertyMetadata STD_OPTIONAL

    - #### STD_REQUIRED_OR_OPTIONAL

          public static final PropertyMetadata STD_REQUIRED_OR_OPTIONAL

    - #### _required

          protected final Boolean _required

      Three states: required, not required and unknown; unknown represented as null.

    - #### _description

          protected final String _description

      Optional human-readable description associated with the property.

    - #### _index

          protected final Integer _index

      Optional index of the property within containing Object.
      Since:
        2.4

    - #### _defaultValue

          protected final String _defaultValue

      Optional default value, as String, for property; not used for any functionality by core databind, offered as metadata for extensions.

    - #### _mergeInfo

          protected final transient PropertyMetadata.MergeInfo _mergeInfo

      Settings regarding merging, if property is determined to possibly be mergeable (possibly since global settings may be omitted for non-mergeable types).

      NOTE: transient since it is assumed that this information is only relevant during initial setup and not needed after full initialization. May be changed if this proves necessary.

      Since:
        2.9

    - #### _valueNulls

          protected Nulls _valueNulls

      Settings regarding handling of incoming `null`s, both for value itself and, for structured types, content values (array/Collection elements, Map values).
      Since:
        2.9

    - #### _contentNulls

          protected Nulls _contentNulls

      Settings regarding handling of incoming `null`s, both for value itself and, for structured types, content values (array/Collection elements, Map values).
      Since:
        2.9

  - ### Constructor Detail

    - #### PropertyMetadata

          protected PropertyMetadata(Boolean req,
                                     String desc,
                                     Integer index,
                                     String def,
                                     PropertyMetadata.MergeInfo mergeInfo,
                                     Nulls valueNulls,
                                     Nulls contentNulls)

      Since:
        2.9

  - ### Method Detail

    - #### construct

          public static PropertyMetadata construct(Boolean req,
                                                   String desc,
                                                   Integer index,
                                                   String defaultValue)

      Since:
        2.8.8

    - #### construct

          @Deprecated
          public static PropertyMetadata construct(boolean req,
                                                               String desc,
                                                               Integer index,
                                                               String defaultValue)

      Deprecated.

    - #### readResolve

          protected Object readResolve()

      Minor optimization: let's canonicalize back to placeholders in cases where there is no real data to consider

    - #### withDescription

          public PropertyMetadata withDescription(String desc)

    - #### withMergeInfo

          public PropertyMetadata withMergeInfo(PropertyMetadata.MergeInfo mergeInfo)

      Since:
        2.9

    - #### withNulls

          public PropertyMetadata withNulls(Nulls valueNulls,
                                            Nulls contentNulls)

      Since:
        2.9

    - #### withDefaultValue

          public PropertyMetadata withDefaultValue(String def)

    - #### withIndex

          public PropertyMetadata withIndex(Integer index)

    - #### withRequired

          public PropertyMetadata withRequired(Boolean b)

    - #### getDescription

          public String getDescription()

    - #### getDefaultValue

          public String getDefaultValue()

      Since:
        2.5

    - #### hasDefaultValue

          public boolean hasDefaultValue()

      Accessor for determining whether property has declared "default value", which may be used by extension modules.
      Since:
        2.6

    - #### isRequired

          public boolean isRequired()

    - #### getRequired

          public Boolean getRequired()

    - #### getIndex

          public Integer getIndex()

      Since:
        2.4

    - #### hasIndex

          public boolean hasIndex()

      Since:
        2.4

    - #### getMergeInfo

          public PropertyMetadata.MergeInfo getMergeInfo()

      Since:
        2.9

    - #### getValueNulls

          public Nulls getValueNulls()

      Since:
        2.9

    - #### getContentNulls

          public Nulls getContentNulls()

      Since:
        2.9

Copyright © 2008–2020 FasterXML. All rights reserved.