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 placeholders need to store; since instances are immutable, they can be freely shared.
  Since:
    2.3
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected String` | `_defaultValue` Optional default value, as String, for property; not used cor 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 Boolean` | `_required` Three states: required, not required and unknown; unknown represented as null.
    `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)` Deprecated.
    `protected` | `PropertyMetadata(Boolean req, String desc, Integer index, String def)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static PropertyMetadata` | `construct(boolean req, String desc)` Deprecated.
    `static PropertyMetadata` | `construct(boolean req, String desc, Integer index, String defaultValue)`
    `String` | `getDefaultValue()`
    `String` | `getDescription()`
    `Integer` | `getIndex()`
    `Boolean` | `getRequired()`
    `boolean` | `hasDefaultValue()` Accessor for determining whether property has declared "default value", which may be used by extension modules.
    `boolean` | `hasDefuaultValue()` Deprecated. Since 2.6: typo in name, use `hasDefaultValue()` instead.
    `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` | `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 cor any functionality by core databind, offered as metadata for extensions.

  - ### Constructor Detail

    - #### PropertyMetadata

          @Deprecated
          protected PropertyMetadata(Boolean req,
                                     String desc)

      Deprecated.

    - #### PropertyMetadata

          protected PropertyMetadata(Boolean req,
                          String desc,
                          Integer index,
                          String def)

      Since:
        2.5

  - ### Method Detail

    - #### construct

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

      Deprecated.
      Since:
        2.4 Use variant that takes more arguments.

    - #### construct

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

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

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

    - #### hasDefuaultValue

          @Deprecated
          public boolean hasDefuaultValue()

      Deprecated. Since 2.6: typo in name, use `hasDefaultValue()` instead.

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

Copyright © 2008–2016 FasterXML. All rights reserved.