com.fasterxml.jackson.databind.deser.impl

## Class BeanPropertyMap

- java.lang.Object
- - com.fasterxml.jackson.databind.deser.impl.BeanPropertyMap

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Iterable<SettableBeanProperty>

      public class BeanPropertyMap
      extends java.lang.Object
      implements java.lang.Iterable<SettableBeanProperty>, java.io.Serializable

  Helper class used for storing mapping from property name to `SettableBeanProperty` instances.

  Note that this class is used instead of generic `HashMap` for bit of performance gain (and some memory savings): although default implementation is very good for generic use cases, it can be streamlined a bit for specific use case we have. Even relatively small improvements matter since this is directly on the critical path during deserialization, as it is done for each and every POJO property deserialized.

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `_caseInsensitive`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `BeanPropertyMap(BeanPropertyMap base, boolean caseInsensitive)`
    `` | `BeanPropertyMap(boolean caseInsensitive, java.util.Collection<SettableBeanProperty> props)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected SettableBeanProperty` | `_rename(SettableBeanProperty prop, NameTransformer xf)`
    `BeanPropertyMap` | `assignIndexes()`
    `static BeanPropertyMap` | `construct(java.util.Collection<SettableBeanProperty> props, boolean caseInsensitive)`
    `SettableBeanProperty` | `find(int index)`
    `SettableBeanProperty` | `find(java.lang.String key)`
    `boolean` | `findDeserializeAndSet(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt, java.lang.Object bean, java.lang.String key)` Convenience method that tries to find property with given name, and if it is found, call `SettableBeanProperty.deserializeAndSet(com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.databind.DeserializationContext, java.lang.Object)` on it, and return true; or, if not found, return false.
    `SettableBeanProperty[]` | `getPropertiesInInsertionOrder()` Method that will re-create initial insertion-ordering of properties contained in this map.
    `protected java.lang.String` | `getPropertyName(SettableBeanProperty prop)`
    `protected void` | `init(java.util.Collection<SettableBeanProperty> props)`
    `java.util.Iterator<SettableBeanProperty>` | `iterator()` Accessor for traversing over all contained properties.
    `void` | `remove(SettableBeanProperty propToRm)` Specialized method for removing specified existing entry.
    `BeanPropertyMap` | `renameAll(NameTransformer transformer)` Mutant factory method for constructing a map where all entries use given prefix
    `void` | `replace(SettableBeanProperty newProp)` Specialized method that can be used to replace an existing entry (note: entry MUST exist; otherwise exception is thrown) with specified replacement.
    `int` | `size()`
    `java.lang.String` | `toString()`
    `BeanPropertyMap` | `withCaseInsensitivity(boolean state)` Mutant factory method that constructs a new instance if desired case-insensitivity state differs from the state of this instance; if states are the same, returns `this`.
    `BeanPropertyMap` | `withoutProperties(java.util.Collection<java.lang.String> toExclude)` Mutant factory method that will use this instance as the base, and construct an instance that is otherwise same except for excluding properties with specified names.
    `BeanPropertyMap` | `withProperty(SettableBeanProperty newProp)` Fluent copy method that creates a new instance that is a copy of this instance except for one additional property that is passed as the argument.
    `protected void` | `wrapAndThrow(java.lang.Throwable t, java.lang.Object bean, java.lang.String fieldName, DeserializationContext ctxt)`

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

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

- - ### Field Detail

    - #### _caseInsensitive

          protected final boolean _caseInsensitive

      Since:
        2.5

  - ### Constructor Detail

    - #### BeanPropertyMap

          public BeanPropertyMap(boolean caseInsensitive,
                         java.util.Collection<SettableBeanProperty> props)

    - #### BeanPropertyMap

          protected BeanPropertyMap(BeanPropertyMap base,
                         boolean caseInsensitive)

      Since:
        2.8

  - ### Method Detail

    - #### withCaseInsensitivity

          public BeanPropertyMap withCaseInsensitivity(boolean state)

      Mutant factory method that constructs a new instance if desired case-insensitivity state differs from the state of this instance; if states are the same, returns `this`.
      Since:
        2.8

    - #### init

          protected void init(java.util.Collection<SettableBeanProperty> props)

    - #### construct

          public static BeanPropertyMap construct(java.util.Collection<SettableBeanProperty> props,
                                  boolean caseInsensitive)

      Since:
        2.6

    - #### withProperty

          public BeanPropertyMap withProperty(SettableBeanProperty newProp)

      Fluent copy method that creates a new instance that is a copy of this instance except for one additional property that is passed as the argument. Note that method does not modify this instance but constructs and returns a new one.

    - #### assignIndexes

          public BeanPropertyMap assignIndexes()

    - #### renameAll

          public BeanPropertyMap renameAll(NameTransformer transformer)

      Mutant factory method for constructing a map where all entries use given prefix

    - #### withoutProperties

          public BeanPropertyMap withoutProperties(java.util.Collection<java.lang.String> toExclude)

      Mutant factory method that will use this instance as the base, and construct an instance that is otherwise same except for excluding properties with specified names.
      Since:
        2.8

    - #### replace

          public void replace(SettableBeanProperty newProp)

      Specialized method that can be used to replace an existing entry (note: entry MUST exist; otherwise exception is thrown) with specified replacement.

    - #### iterator

          public java.util.Iterator<SettableBeanProperty> iterator()

      Accessor for traversing over all contained properties.
      Specified by:
        `iterator` in interface `java.lang.Iterable<SettableBeanProperty>`

    - #### getPropertiesInInsertionOrder

          public SettableBeanProperty[] getPropertiesInInsertionOrder()

      Method that will re-create initial insertion-ordering of properties contained in this map. Note that if properties have been removed, array may contain nulls; otherwise it should be consecutive.
      Since:
        2.1

    - #### getPropertyName

          protected final java.lang.String getPropertyName(SettableBeanProperty prop)

    - #### find

          public SettableBeanProperty find(int index)

      Since:
        2.3

    - #### find

          public SettableBeanProperty find(java.lang.String key)

    - #### size

          public int size()

    - #### remove

          public void remove(SettableBeanProperty propToRm)

      Specialized method for removing specified existing entry. NOTE: entry MUST exist, otherwise an exception is thrown.

    - #### findDeserializeAndSet

          public boolean findDeserializeAndSet(com.fasterxml.jackson.core.JsonParser p,
                                      DeserializationContext ctxt,
                                      java.lang.Object bean,
                                      java.lang.String key)
                                        throws java.io.IOException

      Convenience method that tries to find property with given name, and if it is found, call `SettableBeanProperty.deserializeAndSet(com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.databind.DeserializationContext, java.lang.Object)` on it, and return true; or, if not found, return false. Note, too, that if deserialization is attempted, possible exceptions are wrapped if and as necessary, so caller need not handle those.
      Throws:
        `java.io.IOException`
      Since:
        2.5

    - #### toString

          public java.lang.String toString()

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

    - #### _rename

          protected SettableBeanProperty _rename(SettableBeanProperty prop,
                                     NameTransformer xf)

    - #### wrapAndThrow

          protected void wrapAndThrow(java.lang.Throwable t,
                          java.lang.Object bean,
                          java.lang.String fieldName,
                          DeserializationContext ctxt)
                               throws java.io.IOException

      Throws:
        `java.io.IOException`