Class 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
    • Constructor Detail

      • BeanPropertyMap

        public BeanPropertyMap​(boolean caseInsensitive,
                               java.util.Collection<SettableBeanProperty> props,
                               java.util.Map<java.lang.String,​java.util.List<PropertyName>> aliasDefs,
                               java.util.Locale locale)
        Since:
        2.11
      • BeanPropertyMap

        @Deprecated
        public BeanPropertyMap​(boolean caseInsensitive,
                               java.util.Collection<SettableBeanProperty> props,
                               java.util.Map<java.lang.String,​java.util.List<PropertyName>> aliasDefs)
        Deprecated.
        since 2.11
    • 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
      • construct

        @Deprecated
        public static BeanPropertyMap construct​(java.util.Collection<SettableBeanProperty> props,
                                                boolean caseInsensitive,
                                                java.util.Map<java.lang.String,​java.util.List<PropertyName>> aliasMapping)
        Deprecated.
        since 2.11
      • 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.
      • 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
      • withoutProperties

        public BeanPropertyMap withoutProperties​(java.util.Collection<java.lang.String> toExclude,
                                                 java.util.Collection<java.lang.String> toInclude)
        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, or including only the one marked as included
        Since:
        2.12
      • replace

        public void replace​(SettableBeanProperty origProp,
                            SettableBeanProperty newProp)
        Specialized method that can be used to replace an existing entry (note: entry MUST exist; otherwise exception is thrown) with specified replacement.
        Since:
        2.9.4
      • remove

        public void remove​(SettableBeanProperty propToRm)
        Specialized method for removing specified existing entry. NOTE: entry MUST exist, otherwise an exception is thrown.
      • size

        public int size()
      • isCaseInsensitive

        public boolean isCaseInsensitive()
        Since:
        2.9
      • hasAliases

        public boolean hasAliases()
        Since:
        2.9
      • 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
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object