Top Description Fields Constructors Methods
tools.jackson.databind.deser.bean

public Class BeanPropertyMap

extends Object
implements Iterable<SettableBeanProperty>
Class Inheritance
All Implemented Interfaces
java.lang.Iterable
Imports
java.util.*, tools.jackson.core.TokenStreamFactory, tools.jackson.core.sym.PropertyNameMatcher, tools.jackson.core.util.Named, tools.jackson.databind.DeserializationContext, .PropertyName, tools.jackson.databind.cfg.MapperConfig, tools.jackson.databind.deser.SettableBeanProperty, tools.jackson.databind.util.IgnorePropertiesUtil, .NameTransformer

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

Note that this class is used instead of generic java.util.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.

Field Summary

Modifier and TypeField and Description
private final PropertyName[][]
_aliasDefs

Configuration of alias mappings, if any (`null` if none), aligned with properties in _propsInOrder

private final boolean
private final Locale
private transient PropertyNameMatcher
private SettableBeanProperty[]
_propsInOrder

Array of properties in the exact order they were handed in. This is used by as-array serialization, deserialization.

private transient SettableBeanProperty[]
_propsWithAliases

Lazily instantiated array of properties mapped from lookup index, in which first entries are same as in _propsInOrder followed by alias mappings.

Constructor Summary

AccessConstructor and Description
protected
BeanPropertyMap(Collection<SettableBeanProperty>
Sequence of primary properties to index
props
,
PropertyName[][]
Alias mappings, if any (null if none)
aliasDefs
,
Locale locale, boolean
Whether property name matching should case-insensitive or not
caseInsensitive
,
boolean
Whether to assign indices to property entities or not
assignIndexes
)

protected
BeanPropertyMap(BeanPropertyMap base, boolean caseInsensitive)

Method Summary

Modifier and TypeMethod and Description
public static BeanPropertyMap
construct(MapperConfig<?> config, Collection<SettableBeanProperty> props, PropertyName[][] aliases, boolean caseInsensitive)

public SettableBeanProperty
findDefinition(int index)

public SettableBeanProperty
findDefinition(String key)

Note

does NOT do case-insensitive matching -- only to be used during construction and never during deserialization process -- nor alias expansion.

public PropertyNameMatcher
public SettableBeanProperty[]
public SettableBeanProperty[]
getPrimaryProperties()

Method that will re-create initial insertion-ordering of properties contained in this map.

public boolean
public BeanPropertyMap
public boolean
public Iterator<SettableBeanProperty>
iterator()

Implements java.lang.Iterable.iterator.

Accessor for traversing over all contained properties.

public void
remove(SettableBeanProperty propToRm)

Specialized method for removing specified existing entry.

public BeanPropertyMap
renameAll(DeserializationContext ctxt, NameTransformer transformer)

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

public void
replace(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.

public int
size()

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

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.

public BeanPropertyMap
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.

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

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.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

_aliasDefsback to summary
private final PropertyName[][] _aliasDefs

Configuration of alias mappings, if any (`null` if none), aligned with properties in _propsInOrder

_caseInsensitiveback to summary
private final boolean _caseInsensitive
_localeback to summary
private final Locale _locale
_nameMatcherback to summary
private transient PropertyNameMatcher _nameMatcher
_propsInOrderback to summary
private SettableBeanProperty[] _propsInOrder

Array of properties in the exact order they were handed in. This is used by as-array serialization, deserialization. Contains both primary properties (first _primaryCount entries) and possible aliased mappings

_propsWithAliasesback to summary
private transient SettableBeanProperty[] _propsWithAliases

Lazily instantiated array of properties mapped from lookup index, in which first entries are same as in _propsInOrder followed by alias mappings.

Constructor Detail

BeanPropertyMapback to summary
protected BeanPropertyMap(Collection<SettableBeanProperty> props, PropertyName[][] aliasDefs, Locale locale, boolean caseInsensitive, boolean assignIndexes)
Parameters
props:Collection<SettableBeanProperty>

Sequence of primary properties to index

aliasDefs:PropertyName[][]

Alias mappings, if any (null if none)

caseInsensitive:boolean

Whether property name matching should case-insensitive or not

assignIndexes:boolean

Whether to assign indices to property entities or not

BeanPropertyMapback to summary
protected BeanPropertyMap(BeanPropertyMap base, boolean caseInsensitive)

Method Detail

constructback to summary
public static BeanPropertyMap construct(MapperConfig<?> config, Collection<SettableBeanProperty> props, PropertyName[][] aliases, boolean caseInsensitive)
findDefinitionback to summary
public SettableBeanProperty findDefinition(int index)
findDefinitionback to summary
public SettableBeanProperty findDefinition(String key)

Note

does NOT do case-insensitive matching -- only to be used during construction and never during deserialization process -- nor alias expansion.

getNameMatcherback to summary
public PropertyNameMatcher getNameMatcher()
getNameMatcherPropertiesback to summary
public SettableBeanProperty[] getNameMatcherProperties()
getPrimaryPropertiesback to summary
public 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.

hasAliasesback to summary
public boolean hasAliases()
initMatcherback to summary
public BeanPropertyMap initMatcher(TokenStreamFactory tsf)
isCaseInsensitiveback to summary
public boolean isCaseInsensitive()
iteratorback to summary
public Iterator<SettableBeanProperty> iterator()

Implements java.lang.Iterable.iterator.

Accessor for traversing over all contained properties.

Annotations
@Override
removeback to summary
public void remove(SettableBeanProperty propToRm)

Specialized method for removing specified existing entry.

Note

entry MUST exist, otherwise an exception is thrown.

renameAllback to summary
public BeanPropertyMap renameAll(DeserializationContext ctxt, NameTransformer transformer)

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

replaceback to summary
public void replace(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.

sizeback to summary
public int size()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
withCaseInsensitivityback to summary
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.

withoutPropertiesback to summary
public BeanPropertyMap 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.

withoutPropertiesback to summary
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

withPropertyback to summary
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.