java.lang.Object
tools.jackson.databind.deser.bean.BeanPropertyMap
- All Implemented Interfaces:
Iterable<SettableBeanProperty>
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.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBeanPropertyMap(Collection<SettableBeanProperty> props, PropertyName[][] aliasDefs, Locale locale, boolean caseInsensitive, boolean assignIndexes) protectedBeanPropertyMap(BeanPropertyMap base, boolean caseInsensitive) -
Method Summary
Modifier and TypeMethodDescriptionstatic BeanPropertyMapconstruct(MapperConfig<?> config, Collection<SettableBeanProperty> props, PropertyName[][] aliases, boolean caseInsensitive) findDefinition(int index) findDefinition(String key) NOTE: does NOT do case-insensitive matching -- only to be used during construction and never during deserialization process -- nor alias expansion.Method that will re-create initial insertion-ordering of properties contained in this map.booleanbooleaniterator()Accessor for traversing over all contained properties.voidremove(SettableBeanProperty propToRm) Specialized method for removing specified existing entry.renameAll(DeserializationContext ctxt, NameTransformer transformer) Mutant factory method for constructing a map where all entries use given prefixvoidreplace(SettableBeanProperty oldProp, SettableBeanProperty newProp) Specialized method that can be used to replace an existing entry (note: entry MUST exist; otherwise exception is thrown) with specified replacement.intsize()toString()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, returnsthis.withoutProperties(Collection<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.withoutProperties(Collection<String> toExclude, Collection<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 includedwithProperty(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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
BeanPropertyMap
protected BeanPropertyMap(Collection<SettableBeanProperty> props, PropertyName[][] aliasDefs, Locale locale, boolean caseInsensitive, boolean assignIndexes) - Parameters:
caseInsensitive- Whether property name matching should case-insensitive or notprops- Sequence of primary properties to indexaliasDefs- Alias mappings, if any (null if none)assignIndexes- Whether to assign indices to property entities or not
-
BeanPropertyMap
-
-
Method Details
-
construct
public static BeanPropertyMap construct(MapperConfig<?> config, Collection<SettableBeanProperty> props, PropertyName[][] aliases, boolean caseInsensitive) -
withCaseInsensitivity
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, returnsthis. -
withProperty
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
Mutant factory method for constructing a map where all entries use given prefix -
withoutProperties
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. -
withoutProperties
public BeanPropertyMap withoutProperties(Collection<String> toExclude, Collection<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 -
replace
Specialized method that can be used to replace an existing entry (note: entry MUST exist; otherwise exception is thrown) with specified replacement. -
remove
Specialized method for removing specified existing entry. NOTE: entry MUST exist, otherwise an exception is thrown. -
initMatcher
-
getNameMatcher
-
getNameMatcherProperties
-
size
public int size() -
isCaseInsensitive
public boolean isCaseInsensitive() -
hasAliases
public boolean hasAliases() -
iterator
Accessor for traversing over all contained properties.- Specified by:
iteratorin interfaceIterable<SettableBeanProperty>
-
getPrimaryProperties
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. -
findDefinition
-
findDefinition
NOTE: does NOT do case-insensitive matching -- only to be used during construction and never during deserialization process -- nor alias expansion. -
toString
-