Class PropertyValueBuffer
- java.lang.Object
-
- com.fasterxml.jackson.databind.deser.impl.PropertyValueBuffer
-
public class PropertyValueBuffer extends java.lang.Object
Simple container used for temporarily buffering a set ofPropertyValue
s. Using during construction of beans (and Maps) that use Creators, and hence need buffering before instance (that will have properties to assign values to) is constructed.
-
-
Field Summary
Fields Modifier and Type Field Description protected PropertyValue
_buffered
If we get non-creator parameters before or between creator parameters, those need to be buffered.protected DeserializationContext
_context
protected java.lang.Object[]
_creatorParameters
Buffer used for storing creator parameters for constructing instance.protected java.lang.Object
_idValue
In case there is an Object Id property to handle, this is the value we have for it.protected ObjectIdReader
_objectIdReader
protected int
_paramsNeeded
Number of creator parameters for which we have not yet received values.protected int
_paramsSeen
Bitflag used to track parameters found from incoming data when number of parameters is less than 32 (fits in int).protected java.util.BitSet
_paramsSeenBig
Bitflag used to track parameters found from incoming data when number of parameters is 32 or higher.protected com.fasterxml.jackson.core.JsonParser
_parser
-
Constructor Summary
Constructors Constructor Description PropertyValueBuffer(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt, int paramCount, ObjectIdReader oir)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Object
_findMissing(SettableBeanProperty prop)
boolean
assignParameter(SettableBeanProperty prop, java.lang.Object value)
Method called to buffer value for given property, as well as check whether we now have values for all (creator) properties that we expect to get values for.void
bufferAnyProperty(SettableAnyProperty prop, java.lang.String propName, java.lang.Object value)
protected PropertyValue
buffered()
void
bufferMapProperty(java.lang.Object key, java.lang.Object value)
void
bufferProperty(SettableBeanProperty prop, java.lang.Object value)
java.lang.Object
getParameter(SettableBeanProperty prop)
A variation ofgetParameters(SettableBeanProperty[])
that accepts a single property.java.lang.Object[]
getParameters(SettableBeanProperty[] props)
Method called to do necessary post-processing such as injection of values and verification of values for required properties, after eitherassignParameter(SettableBeanProperty, Object)
returnstrue
(to indicate all creator properties are found), or when then whole JSON Object has been processed,java.lang.Object
handleIdValue(DeserializationContext ctxt, java.lang.Object bean)
Helper method called to handle Object Id value collected earlier, if anyboolean
hasParameter(SettableBeanProperty prop)
Returnstrue
if the given property was seen in the JSON source by this buffer.boolean
isComplete()
boolean
readIdProperty(java.lang.String propName)
Helper method called to see if given non-creator property is the "id property"; and if so, handle appropriately.
-
-
-
Field Detail
-
_parser
protected final com.fasterxml.jackson.core.JsonParser _parser
-
_context
protected final DeserializationContext _context
-
_objectIdReader
protected final ObjectIdReader _objectIdReader
-
_creatorParameters
protected final java.lang.Object[] _creatorParameters
Buffer used for storing creator parameters for constructing instance.
-
_paramsNeeded
protected int _paramsNeeded
Number of creator parameters for which we have not yet received values.
-
_paramsSeen
protected int _paramsSeen
Bitflag used to track parameters found from incoming data when number of parameters is less than 32 (fits in int).
-
_paramsSeenBig
protected final java.util.BitSet _paramsSeenBig
Bitflag used to track parameters found from incoming data when number of parameters is 32 or higher.
-
_buffered
protected PropertyValue _buffered
If we get non-creator parameters before or between creator parameters, those need to be buffered. Buffer is just a simple linked list
-
_idValue
protected java.lang.Object _idValue
In case there is an Object Id property to handle, this is the value we have for it.
-
-
Constructor Detail
-
PropertyValueBuffer
public PropertyValueBuffer(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt, int paramCount, ObjectIdReader oir)
-
-
Method Detail
-
hasParameter
public final boolean hasParameter(SettableBeanProperty prop)
Returnstrue
if the given property was seen in the JSON source by this buffer.- Since:
- 2.8
-
getParameter
public java.lang.Object getParameter(SettableBeanProperty prop) throws JsonMappingException
A variation ofgetParameters(SettableBeanProperty[])
that accepts a single property. Whereas the plural form eagerly fetches and validates all properties, this method may be used (along withhasParameter(SettableBeanProperty)
) to let applications only fetch the properties defined in the JSON source itself, and to have some other customized behavior for missing properties.- Throws:
JsonMappingException
- Since:
- 2.8
-
getParameters
public java.lang.Object[] getParameters(SettableBeanProperty[] props) throws JsonMappingException
Method called to do necessary post-processing such as injection of values and verification of values for required properties, after eitherassignParameter(SettableBeanProperty, Object)
returnstrue
(to indicate all creator properties are found), or when then whole JSON Object has been processed,- Throws:
JsonMappingException
-
_findMissing
protected java.lang.Object _findMissing(SettableBeanProperty prop) throws JsonMappingException
- Throws:
JsonMappingException
-
readIdProperty
public boolean readIdProperty(java.lang.String propName) throws java.io.IOException
Helper method called to see if given non-creator property is the "id property"; and if so, handle appropriately.- Throws:
java.io.IOException
- Since:
- 2.1
-
handleIdValue
public java.lang.Object handleIdValue(DeserializationContext ctxt, java.lang.Object bean) throws java.io.IOException
Helper method called to handle Object Id value collected earlier, if any- Throws:
java.io.IOException
-
buffered
protected PropertyValue buffered()
-
isComplete
public boolean isComplete()
-
assignParameter
public boolean assignParameter(SettableBeanProperty prop, java.lang.Object value)
Method called to buffer value for given property, as well as check whether we now have values for all (creator) properties that we expect to get values for.- Returns:
- True if we have received all creator parameters
- Since:
- 2.6
-
bufferProperty
public void bufferProperty(SettableBeanProperty prop, java.lang.Object value)
-
bufferAnyProperty
public void bufferAnyProperty(SettableAnyProperty prop, java.lang.String propName, java.lang.Object value)
-
bufferMapProperty
public void bufferMapProperty(java.lang.Object key, java.lang.Object value)
-
-