com.fasterxml.jackson.databind.deser

## Class SettableBeanProperty

- java.lang.Object
- - com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase
  - - com.fasterxml.jackson.databind.deser.SettableBeanProperty

- All Implemented Interfaces:
    BeanProperty, Named, java.io.Serializable
  Direct Known Subclasses:
    CreatorProperty, FieldProperty, InnerClassProperty, ManagedReferenceProperty, MethodProperty, ObjectIdReferenceProperty, ObjectIdValueProperty, SetterlessProperty

      public abstract class SettableBeanProperty
      extends ConcreteBeanPropertyBase
      implements java.io.Serializable

  Base class for deserializable properties of a bean: contains both type and name definitions, and reflection-based set functionality. Concrete sub-classes implement details, so that field- and setter-backed properties, as well as a few more esoteric variations, can be handled.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.fasterxml.jackson.databind.BeanProperty

      `BeanProperty.Std`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Annotations` | `_contextAnnotations` Class that contains this property (either class that declares the property or one of its subclasses), class that is deserialized using deserializer that contains this property.
    `protected java.lang.String` | `_managedReferenceName` If property represents a managed (forward) reference (see [JACKSON-235]), we will need name of reference for later linking.
    `protected ObjectIdInfo` | `_objectIdInfo` This is the information for object identity associated with the property.
    `protected int` | `_propertyIndex` Index of property (within all property of a bean); assigned when all properties have been collected.
    `protected PropertyName` | `_propName` Logical name of the property (often but not always derived from the setter method name)
    `protected JavaType` | `_type` Base type for property; may be a supertype of actual value.
    `protected JsonDeserializer<java.lang.Object>` | `_valueDeserializer` Deserializer used for handling property value.
    `protected TypeDeserializer` | `_valueTypeDeserializer` If value will contain type information (to support polymorphic handling), this is the type deserializer used to handle type resolution.
    `protected ViewMatcher` | `_viewMatcher` Helper object used for checking whether this property is to be included in the active view, if property is view-specific; null otherwise.
    `protected PropertyName` | `_wrapperName`
    `protected static JsonDeserializer<java.lang.Object>` | `MISSING_VALUE_DESERIALIZER` To avoid nasty NPEs, let's use a placeholder for _valueDeserializer, if real deserializer is not (yet) available.

    - ### Fields inherited from class com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase

      `_metadata, _propertyFormat`

    - ### Fields inherited from interface com.fasterxml.jackson.databind.BeanProperty

      `EMPTY_FORMAT, EMPTY_INCLUDE`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `SettableBeanProperty(BeanPropertyDefinition propDef, JavaType type, TypeDeserializer typeDeser, Annotations contextAnnotations)`
    `protected` | `SettableBeanProperty(PropertyName propName, JavaType type, PropertyMetadata metadata, JsonDeserializer<java.lang.Object> valueDeser)` Constructor only used by `ObjectIdValueProperty`.
    `protected` | `SettableBeanProperty(PropertyName propName, JavaType type, PropertyName wrapper, TypeDeserializer typeDeser, Annotations contextAnnotations, PropertyMetadata metadata)`
    `protected` | `SettableBeanProperty(SettableBeanProperty src)` Basic copy-constructor for sub-classes to use.
    `protected` | `SettableBeanProperty(SettableBeanProperty src, JsonDeserializer<?> deser)` Copy-with-deserializer-change constructor for sub-classes to use.
    `protected` | `SettableBeanProperty(SettableBeanProperty src, PropertyName newName)` Copy-with-deserializer-change constructor for sub-classes to use.
    `protected` | `SettableBeanProperty(java.lang.String propName, JavaType type, PropertyName wrapper, TypeDeserializer typeDeser, Annotations contextAnnotations, boolean isRequired)` Deprecated.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected java.io.IOException` | `_throwAsIOE(java.lang.Exception e)` Deprecated.
    `protected void` | `_throwAsIOE(java.lang.Exception e, java.lang.Object value)`
    `protected java.io.IOException` | `_throwAsIOE(com.fasterxml.jackson.core.JsonParser p, java.lang.Exception e)`
    `protected void` | `_throwAsIOE(com.fasterxml.jackson.core.JsonParser p, java.lang.Exception e, java.lang.Object value)` Method that takes in exception of any type, and casts or wraps it to an IOException or its subclass.
    `void` | `assignIndex(int index)` Method used to assign index for property.
    `void` | `depositSchemaProperty(JsonObjectFormatVisitor objectVisitor, SerializerProvider provider)` Method that can be called to visit the type structure that this property is part of.
    `java.lang.Object` | `deserialize(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt)` This method is needed by some specialized bean deserializers, and also called by some `deserializeAndSet(com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.databind.DeserializationContext, java.lang.Object)` implementations.
    `abstract void` | `deserializeAndSet(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt, java.lang.Object instance)` Method called to deserialize appropriate value, given parser (and context), and set it using appropriate mechanism.
    `abstract java.lang.Object` | `deserializeSetAndReturn(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt, java.lang.Object instance)` Alternative to `deserializeAndSet(com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.databind.DeserializationContext, java.lang.Object)` that returns either return value of setter method called (if one is), or null to indicate that no return value is available.
    `void` | `fixAccess(DeserializationConfig config)` Method called to ensure that the mutator has proper access rights to be called, as per configuration.
    `abstract <A extends java.lang.annotation.Annotation> A` | `getAnnotation(java.lang.Class<A> acls)` Method for finding annotation associated with this property; meaning annotation associated with one of entities used to access property.
    `<A extends java.lang.annotation.Annotation> A` | `getContextAnnotation(java.lang.Class<A> acls)` Method for finding annotation associated with context of this property; usually class in which member is declared (or its subtype if processing subtype).
    `int` | `getCreatorIndex()` Method for accessing index of the creator property: for other types of properties will simply return -1.
    `protected java.lang.Class<?>` | `getDeclaringClass()`
    `PropertyName` | `getFullName()` Method for getting full name definition, including possible format-specific additional properties (such as namespace when using XML backend).
    `java.lang.Object` | `getInjectableValueId()` Accessor for id of injectable value, if this bean property supports value injection.
    `java.lang.String` | `getManagedReferenceName()`
    `abstract AnnotatedMember` | `getMember()` Method for accessing primary physical entity that represents the property; annotated field, method or constructor property.
    `java.lang.String` | `getName()` Method to get logical name of the property
    `ObjectIdInfo` | `getObjectIdInfo()`
    `int` | `getPropertyIndex()` Method for accessing unique index of this property; indexes are assigned once all properties of a `BeanDeserializer` have been collected.
    `JavaType` | `getType()` Method to get declared type of the property.
    `JsonDeserializer<java.lang.Object>` | `getValueDeserializer()`
    `TypeDeserializer` | `getValueTypeDeserializer()`
    `PropertyName` | `getWrapperName()` If property is indicated to be wrapped, name of wrapper element to use.
    `boolean` | `hasValueDeserializer()`
    `boolean` | `hasValueTypeDeserializer()`
    `boolean` | `hasViews()`
    `abstract void` | `set(java.lang.Object instance, java.lang.Object value)` Method called to assign given value to this property, on specified Object.
    `abstract java.lang.Object` | `setAndReturn(java.lang.Object instance, java.lang.Object value)` Method called to assign given value to this property, on specified Object, and return whatever delegating accessor returned (if anything)
    `void` | `setManagedReferenceName(java.lang.String n)`
    `void` | `setObjectIdInfo(ObjectIdInfo objectIdInfo)`
    `void` | `setViews(java.lang.Class<?>[] views)`
    `java.lang.String` | `toString()`
    `boolean` | `visibleInView(java.lang.Class<?> activeView)`
    `abstract SettableBeanProperty` | `withName(PropertyName newName)` Fluent factory method for constructing and returning a new instance with specified property name.
    `SettableBeanProperty` | `withName(java.lang.String simpleName)` Deprecated.
    `SettableBeanProperty` | `withSimpleName(java.lang.String simpleName)`
    `abstract SettableBeanProperty` | `withValueDeserializer(JsonDeserializer<?> deser)` Fluent factory method for constructing and returning a new instance with specified value deserializer.

    - ### Methods inherited from class com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase

      `findFormatOverrides, findPropertyFormat, findPropertyInclusion, getMetadata, isRequired, isVirtual`

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

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

- - ### Field Detail

    - #### MISSING_VALUE_DESERIALIZER

          protected static final JsonDeserializer<java.lang.Object> MISSING_VALUE_DESERIALIZER

      To avoid nasty NPEs, let's use a placeholder for _valueDeserializer, if real deserializer is not (yet) available.
      Since:
        2.2

    - #### _propName

          protected final PropertyName _propName

      Logical name of the property (often but not always derived from the setter method name)

    - #### _type

          protected final JavaType _type

      Base type for property; may be a supertype of actual value.

    - #### _wrapperName

          protected final PropertyName _wrapperName

      Since:
        2.2

    - #### _contextAnnotations

          protected final transient Annotations _contextAnnotations

      Class that contains this property (either class that declares the property or one of its subclasses), class that is deserialized using deserializer that contains this property.

    - #### _valueDeserializer

          protected final JsonDeserializer<java.lang.Object> _valueDeserializer

      Deserializer used for handling property value.

      NOTE: has been immutable since 2.3

    - #### _valueTypeDeserializer

          protected final TypeDeserializer _valueTypeDeserializer

      If value will contain type information (to support polymorphic handling), this is the type deserializer used to handle type resolution.

    - #### _managedReferenceName

          protected java.lang.String _managedReferenceName

      If property represents a managed (forward) reference (see [JACKSON-235]), we will need name of reference for later linking.

      TODO: should try to make immutable.

    - #### _objectIdInfo

          protected ObjectIdInfo _objectIdInfo

      This is the information for object identity associated with the property.

      TODO: should try to make immutable.

    - #### _viewMatcher

          protected ViewMatcher _viewMatcher

      Helper object used for checking whether this property is to be included in the active view, if property is view-specific; null otherwise.

      TODO: should try to make immutable.

    - #### _propertyIndex

          protected int _propertyIndex

      Index of property (within all property of a bean); assigned when all properties have been collected. Order of entries is arbitrary, but once indexes are assigned they are not changed.

      TODO: should try to make immutable if at all possible

  - ### Constructor Detail

    - #### SettableBeanProperty

          protected SettableBeanProperty(BeanPropertyDefinition propDef,
                              JavaType type,
                              TypeDeserializer typeDeser,
                              Annotations contextAnnotations)

    - #### SettableBeanProperty

          @Deprecated
          protected SettableBeanProperty(java.lang.String propName,
                                         JavaType type,
                                         PropertyName wrapper,
                                         TypeDeserializer typeDeser,
                                         Annotations contextAnnotations,
                                         boolean isRequired)

      Deprecated.

    - #### SettableBeanProperty

          protected SettableBeanProperty(PropertyName propName,
                              JavaType type,
                              PropertyName wrapper,
                              TypeDeserializer typeDeser,
                              Annotations contextAnnotations,
                              PropertyMetadata metadata)

    - #### SettableBeanProperty

          protected SettableBeanProperty(PropertyName propName,
                              JavaType type,
                              PropertyMetadata metadata,
                              JsonDeserializer<java.lang.Object> valueDeser)

      Constructor only used by `ObjectIdValueProperty`.
      Since:
        2.3

    - #### SettableBeanProperty

          protected SettableBeanProperty(SettableBeanProperty src)

      Basic copy-constructor for sub-classes to use.

    - #### SettableBeanProperty

          protected SettableBeanProperty(SettableBeanProperty src,
                              JsonDeserializer<?> deser)

      Copy-with-deserializer-change constructor for sub-classes to use.

    - #### SettableBeanProperty

          protected SettableBeanProperty(SettableBeanProperty src,
                              PropertyName newName)

      Copy-with-deserializer-change constructor for sub-classes to use.

  - ### Method Detail

    - #### withValueDeserializer

          public abstract SettableBeanProperty withValueDeserializer(JsonDeserializer<?> deser)

      Fluent factory method for constructing and returning a new instance with specified value deserializer. Note that this method should NOT change configuration of this instance.
      Parameters:
        `deser` - Deserializer to assign to the new property instance
      Returns:
        Newly constructed instance, if value deserializer differs from the one used for this instance; or 'this' if not.

    - #### withName

          public abstract SettableBeanProperty withName(PropertyName newName)

      Fluent factory method for constructing and returning a new instance with specified property name. Note that this method should NOT change configuration of this instance.
      Parameters:
        `newName` - Name to use for the new instance.
      Returns:
        Newly constructed instance, if property name differs from the one used for this instance; or 'this' if not.

    - #### withSimpleName

          public SettableBeanProperty withSimpleName(java.lang.String simpleName)

      Since:
        2.3

    - #### withName

          @Deprecated
          public SettableBeanProperty withName(java.lang.String simpleName)

      Deprecated.

    - #### setManagedReferenceName

          public void setManagedReferenceName(java.lang.String n)

    - #### setObjectIdInfo

          public void setObjectIdInfo(ObjectIdInfo objectIdInfo)

    - #### setViews

          public void setViews(java.lang.Class<?>[] views)

    - #### assignIndex

          public void assignIndex(int index)

      Method used to assign index for property.

    - #### fixAccess

          public void fixAccess(DeserializationConfig config)

      Method called to ensure that the mutator has proper access rights to be called, as per configuration. Overridden by implementations that have mutators that require access, fields and setters.
      Since:
        2.8.3

    - #### getName

          public final java.lang.String getName()

      Description copied from interface: `BeanProperty`
      Method to get logical name of the property
      Specified by:
        `getName` in interface `BeanProperty`
      Specified by:
        `getName` in interface `Named`

    - #### getFullName

          public PropertyName getFullName()

      Description copied from interface: `BeanProperty`
      Method for getting full name definition, including possible format-specific additional properties (such as namespace when using XML backend).
      Specified by:
        `getFullName` in interface `BeanProperty`

    - #### getType

          public JavaType getType()

      Description copied from interface: `BeanProperty`
      Method to get declared type of the property.
      Specified by:
        `getType` in interface `BeanProperty`

    - #### getWrapperName

          public PropertyName getWrapperName()

      Description copied from interface: `BeanProperty`
      If property is indicated to be wrapped, name of wrapper element to use.
      Specified by:
        `getWrapperName` in interface `BeanProperty`

    - #### getMember

          public abstract AnnotatedMember getMember()

      Description copied from interface: `BeanProperty`
      Method for accessing primary physical entity that represents the property; annotated field, method or constructor property.
      Specified by:
        `getMember` in interface `BeanProperty`

    - #### getAnnotation

          public abstract <A extends java.lang.annotation.Annotation> A getAnnotation(java.lang.Class<A> acls)

      Description copied from interface: `BeanProperty`
      Method for finding annotation associated with this property; meaning annotation associated with one of entities used to access property.

      Note that this method should only be called for custom annotations; access to standard Jackson annotations (or ones supported by alternate `AnnotationIntrospector`s) should be accessed through `AnnotationIntrospector`.

      Specified by:
        `getAnnotation` in interface `BeanProperty`

    - #### getContextAnnotation

          public <A extends java.lang.annotation.Annotation> A getContextAnnotation(java.lang.Class<A> acls)

      Description copied from interface: `BeanProperty`
      Method for finding annotation associated with context of this property; usually class in which member is declared (or its subtype if processing subtype).

      Note that this method should only be called for custom annotations; access to standard Jackson annotations (or ones supported by alternate `AnnotationIntrospector`s) should be accessed through `AnnotationIntrospector`.

      Specified by:
        `getContextAnnotation` in interface `BeanProperty`

    - #### depositSchemaProperty

          public void depositSchemaProperty(JsonObjectFormatVisitor objectVisitor,
                                   SerializerProvider provider)
                                     throws JsonMappingException

      Description copied from interface: `BeanProperty`
      Method that can be called to visit the type structure that this property is part of. Note that not all implementations support traversal with this method; those that do not should throw `UnsupportedOperationException`.

      NOTE: Starting with 2.7, takes explicit `SerializerProvider` argument to reduce the need to rely on provider visitor may or may not have assigned.

      Specified by:
        `depositSchemaProperty` in interface `BeanProperty`
      Parameters:
        `objectVisitor` - Visitor to used as the callback handler
      Throws:
        `JsonMappingException`

    - #### getDeclaringClass

          protected final java.lang.Class<?> getDeclaringClass()

    - #### getManagedReferenceName

          public java.lang.String getManagedReferenceName()

    - #### getObjectIdInfo

          public ObjectIdInfo getObjectIdInfo()

    - #### hasValueDeserializer

          public boolean hasValueDeserializer()

    - #### hasValueTypeDeserializer

          public boolean hasValueTypeDeserializer()

    - #### getValueDeserializer

          public JsonDeserializer<java.lang.Object> getValueDeserializer()

    - #### getValueTypeDeserializer

          public TypeDeserializer getValueTypeDeserializer()

    - #### visibleInView

          public boolean visibleInView(java.lang.Class<?> activeView)

    - #### hasViews

          public boolean hasViews()

    - #### getPropertyIndex

          public int getPropertyIndex()

      Method for accessing unique index of this property; indexes are assigned once all properties of a `BeanDeserializer` have been collected.
      Returns:
        Index of this property

    - #### getCreatorIndex

          public int getCreatorIndex()

      Method for accessing index of the creator property: for other types of properties will simply return -1.
      Since:
        2.1

    - #### getInjectableValueId

          public java.lang.Object getInjectableValueId()

      Accessor for id of injectable value, if this bean property supports value injection.

    - #### deserializeAndSet

          public abstract void deserializeAndSet(com.fasterxml.jackson.core.JsonParser p,
                               DeserializationContext ctxt,
                               java.lang.Object instance)
                                          throws java.io.IOException

      Method called to deserialize appropriate value, given parser (and context), and set it using appropriate mechanism. Pre-condition is that passed parser must point to the first token that should be consumed to produce the value (the only value for scalars, multiple for Objects and Arrays).
      Throws:
        `java.io.IOException`

    - #### deserializeSetAndReturn

          public abstract java.lang.Object deserializeSetAndReturn(com.fasterxml.jackson.core.JsonParser p,
                                                 DeserializationContext ctxt,
                                                 java.lang.Object instance)
                                                            throws java.io.IOException

      Alternative to `deserializeAndSet(com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.databind.DeserializationContext, java.lang.Object)` that returns either return value of setter method called (if one is), or null to indicate that no return value is available. Mostly used to support Builder style deserialization.
      Throws:
        `java.io.IOException`
      Since:
        2.0

    - #### set

          public abstract void set(java.lang.Object instance,
                 java.lang.Object value)
                            throws java.io.IOException

      Method called to assign given value to this property, on specified Object.

      Note: this is an optional operation, not supported by all implementations, creator-backed properties for example do not support this method.

      Throws:
        `java.io.IOException`

    - #### setAndReturn

          public abstract java.lang.Object setAndReturn(java.lang.Object instance,
                                      java.lang.Object value)
                                                 throws java.io.IOException

      Method called to assign given value to this property, on specified Object, and return whatever delegating accessor returned (if anything)

      Note: this is an optional operation, not supported by all implementations, creator-backed properties for example do not support this method.

      Throws:
        `java.io.IOException`

    - #### deserialize

          public final java.lang.Object deserialize(com.fasterxml.jackson.core.JsonParser p,
                                     DeserializationContext ctxt)
                                             throws java.io.IOException

      This method is needed by some specialized bean deserializers, and also called by some `deserializeAndSet(com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.databind.DeserializationContext, java.lang.Object)` implementations.

      Pre-condition is that passed parser must point to the first token that should be consumed to produce the value (the only value for scalars, multiple for Objects and Arrays).

      Note that this method is final for performance reasons: to override functionality you must override other methods that call this method; this method should also not be called directly unless you really know what you are doing (and probably not even then).

      Throws:
        `java.io.IOException`

    - #### _throwAsIOE

          protected void _throwAsIOE(com.fasterxml.jackson.core.JsonParser p,
                         java.lang.Exception e,
                         java.lang.Object value)
                              throws java.io.IOException

      Method that takes in exception of any type, and casts or wraps it to an IOException or its subclass.
      Throws:
        `java.io.IOException`

    - #### _throwAsIOE

          protected java.io.IOException _throwAsIOE(com.fasterxml.jackson.core.JsonParser p,
                                        java.lang.Exception e)
                                             throws java.io.IOException

      Throws:
        `java.io.IOException`
      Since:
        2.7

    - #### _throwAsIOE

          @Deprecated
          protected java.io.IOException _throwAsIOE(java.lang.Exception e)
                                             throws java.io.IOException

      Deprecated.
      Throws:
        `java.io.IOException`

    - #### _throwAsIOE

          protected void _throwAsIOE(java.lang.Exception e,
                         java.lang.Object value)
                              throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`