public class BeanPropertyMap extends java.lang.Object implements java.lang.Iterable<SettableBeanProperty>, java.io.Serializable
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.
Modifier and Type | Field and Description |
---|---|
protected boolean |
_caseInsensitive |
private java.lang.Object[] |
_hashArea
Hash area that contains key/property pairs in adjacent elements.
|
private int |
_hashMask |
private SettableBeanProperty[] |
_propsInOrder
Array of properties in the exact order they were handed in.
|
private int |
_size
Number of entries stored in the hash area.
|
private int |
_spillCount |
private static long |
serialVersionUID |
Constructor and Description |
---|
BeanPropertyMap(boolean caseInsensitive,
java.util.Collection<SettableBeanProperty> props) |
Modifier and Type | Method and Description |
---|---|
private SettableBeanProperty |
_find2(java.lang.String key,
int slot,
java.lang.Object match) |
private int |
_findFromOrdered(SettableBeanProperty prop) |
private int |
_findIndexInHash(java.lang.String key)
Helper method used to find exact location of a property with name
given exactly, not subject to case changes, within hash area.
|
private int |
_hashCode(java.lang.String key) |
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. |
private static int |
findSize(int size) |
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.
|
private java.util.List<SettableBeanProperty> |
properties() |
void |
remove(SettableBeanProperty propToRm)
Specialized method for removing specified existing entry.
|
BeanPropertyMap |
renameAll(NameTransformer transformer)
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 |
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) |
private static final long serialVersionUID
protected final boolean _caseInsensitive
private int _hashMask
private int _size
private int _spillCount
private java.lang.Object[] _hashArea
private SettableBeanProperty[] _propsInOrder
public BeanPropertyMap(boolean caseInsensitive, java.util.Collection<SettableBeanProperty> props)
protected void init(java.util.Collection<SettableBeanProperty> props)
private static final int findSize(int size)
public static BeanPropertyMap construct(java.util.Collection<SettableBeanProperty> props, boolean caseInsensitive)
public BeanPropertyMap withProperty(SettableBeanProperty newProp)
public BeanPropertyMap assignIndexes()
public BeanPropertyMap renameAll(NameTransformer transformer)
public void replace(SettableBeanProperty newProp)
private java.util.List<SettableBeanProperty> properties()
public java.util.Iterator<SettableBeanProperty> iterator()
iterator
in interface java.lang.Iterable<SettableBeanProperty>
public SettableBeanProperty[] getPropertiesInInsertionOrder()
protected final java.lang.String getPropertyName(SettableBeanProperty prop)
public SettableBeanProperty find(int index)
public SettableBeanProperty find(java.lang.String key)
private final SettableBeanProperty _find2(java.lang.String key, int slot, java.lang.Object match)
public int size()
public void remove(SettableBeanProperty propToRm)
public boolean findDeserializeAndSet(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt, java.lang.Object bean, java.lang.String key) throws java.io.IOException
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.java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
protected SettableBeanProperty _rename(SettableBeanProperty prop, NameTransformer xf)
protected void wrapAndThrow(java.lang.Throwable t, java.lang.Object bean, java.lang.String fieldName, DeserializationContext ctxt) throws java.io.IOException
java.io.IOException
private final int _findIndexInHash(java.lang.String key)
private final int _findFromOrdered(SettableBeanProperty prop)
private final int _hashCode(java.lang.String key)