public class BeanPropertyMap extends Object implements Iterable<SettableBeanProperty>, 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 |
Constructor and Description |
---|
BeanPropertyMap(boolean caseInsensitive,
Collection<SettableBeanProperty> props) |
Modifier and Type | Method and Description |
---|---|
protected SettableBeanProperty |
_rename(SettableBeanProperty prop,
NameTransformer xf) |
BeanPropertyMap |
assignIndexes() |
static BeanPropertyMap |
construct(Collection<SettableBeanProperty> props,
boolean caseInsensitive) |
SettableBeanProperty |
find(int index) |
SettableBeanProperty |
find(String key) |
boolean |
findDeserializeAndSet(com.fasterxml.jackson.core.JsonParser p,
DeserializationContext ctxt,
Object bean,
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 String |
getPropertyName(SettableBeanProperty prop) |
protected void |
init(Collection<SettableBeanProperty> props) |
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)
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() |
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(Throwable t,
Object bean,
String fieldName,
DeserializationContext ctxt) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public BeanPropertyMap(boolean caseInsensitive, Collection<SettableBeanProperty> props)
protected void init(Collection<SettableBeanProperty> props)
public static BeanPropertyMap construct(Collection<SettableBeanProperty> props, boolean caseInsensitive)
public BeanPropertyMap withProperty(SettableBeanProperty newProp)
public BeanPropertyMap assignIndexes()
public BeanPropertyMap renameAll(NameTransformer transformer)
public void replace(SettableBeanProperty newProp)
public Iterator<SettableBeanProperty> iterator()
iterator
in interface Iterable<SettableBeanProperty>
public SettableBeanProperty[] getPropertiesInInsertionOrder()
protected final String getPropertyName(SettableBeanProperty prop)
public SettableBeanProperty find(int index)
public SettableBeanProperty find(String key)
public int size()
public void remove(SettableBeanProperty propToRm)
public boolean findDeserializeAndSet(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt, Object bean, String key) throws 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.IOException
protected SettableBeanProperty _rename(SettableBeanProperty prop, NameTransformer xf)
protected void wrapAndThrow(Throwable t, Object bean, String fieldName, DeserializationContext ctxt) throws IOException
IOException
Copyright © 2014–2015 FasterXML. All rights reserved.