java.lang.Object
tools.jackson.databind.deser.bean.PropertyValueBuffer
Simple container used for temporarily buffering a set of
PropertyValues.
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
FieldsModifier and TypeFieldDescriptionprotected PropertyValueIf "Any-setter-via-Creator" exists, we will need to buffer values to feed it, separate from regular, non-creator properties (see_buffered).protected final SettableAnyProperty"Any setter" property bound to a Creator parameter (via@JsonAnySetter).protected PropertyValueIf we get non-creator parameters before or between creator parameters, those need to be buffered.protected final DeserializationContextprotected final Object[]Buffer used for storing creator parameters for constructing instance.protected ObjectIn case there is an Object Id property to handle, this is the value we have for it.protected final BitSetIndexes properties that are injectable, if any;nullif none, cleared as they are injected.protected final ObjectIdReaderprotected intNumber of creator parameters for which we have not yet received values.protected intBitflag used to track parameters found from incoming data when number of parameters is less than 32 (fits in int).protected final BitSetBitflag used to track parameters found from incoming data when number of parameters is 32 or higher.protected final JsonParser -
Constructor Summary
ConstructorsConstructorDescriptionPropertyValueBuffer(JsonParser p, DeserializationContext ctxt, int paramCount, ObjectIdReader oir, SettableAnyProperty anyParamSetter, BitSet injectablePropIndexes) -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectbooleanassignParameter(SettableBeanProperty prop, 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.voidbufferAnyParameterProperty(SettableAnyProperty prop, String propName, Object value) voidbufferAnyProperty(SettableAnyProperty prop, String propName, Object value) protected PropertyValuebuffered()voidbufferMapProperty(Object key, Object value) voidbufferMergingProperty(SettableBeanProperty prop, TokenBuffer buffered) voidbufferProperty(SettableBeanProperty prop, Object value) getParameter(DeserializationContext ctxt, SettableBeanProperty prop) A variation ofgetParameters(tools.jackson.databind.DeserializationContext, tools.jackson.databind.deser.SettableBeanProperty[])that accepts a single property.Object[]getParameters(DeserializationContext ctxt, 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 the whole JSON Object has been processed,handleIdValue(DeserializationContext ctxt, Object bean) Helper method called to handle Object Id value collected earlier, if anyfinal booleanReturnstrueif the given property was seen in the JSON source by this buffer.booleanbooleanreadIdProperty(String propName) Helper method called to see if given non-creator property is the "id property"; and if so, handle appropriately.
-
Field Details
-
_parser
-
_context
-
_objectIdReader
-
_creatorParameters
Buffer used for storing creator parameters for constructing instance. -
_paramsNeeded
protected int _paramsNeededNumber of creator parameters for which we have not yet received values. -
_paramsSeen
protected int _paramsSeenBitflag used to track parameters found from incoming data when number of parameters is less than 32 (fits in int). -
_paramsSeenBig
Bitflag used to track parameters found from incoming data when number of parameters is 32 or higher. -
_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
In case there is an Object Id property to handle, this is the value we have for it. -
_anyParamSetter
"Any setter" property bound to a Creator parameter (via@JsonAnySetter).- Since:
- 2.18
-
_anyParamBuffered
If "Any-setter-via-Creator" exists, we will need to buffer values to feed it, separate from regular, non-creator properties (see_buffered).- Since:
- 2.18
-
_injectablePropIndexes
Indexes properties that are injectable, if any;nullif none, cleared as they are injected.- Since:
- 2.21
-
-
Constructor Details
-
PropertyValueBuffer
public PropertyValueBuffer(JsonParser p, DeserializationContext ctxt, int paramCount, ObjectIdReader oir, SettableAnyProperty anyParamSetter, BitSet injectablePropIndexes) - Since:
- 3.1
-
-
Method Details
-
hasParameter
Returnstrueif the given property was seen in the JSON source by this buffer. -
getParameter
public Object getParameter(DeserializationContext ctxt, SettableBeanProperty prop) throws JacksonException A variation ofgetParameters(tools.jackson.databind.DeserializationContext, tools.jackson.databind.deser.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:
JacksonException
-
getParameters
public Object[] getParameters(DeserializationContext ctxt, SettableBeanProperty[] props) throws JacksonException 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 the whole JSON Object has been processed,- Throws:
JacksonException
-
_findMissing
- Throws:
JacksonException
-
readIdProperty
Helper method called to see if given non-creator property is the "id property"; and if so, handle appropriately.- Throws:
JacksonException
-
handleIdValue
Helper method called to handle Object Id value collected earlier, if any- Throws:
JacksonException
-
buffered
-
isComplete
public boolean isComplete() -
assignParameter
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
-
bufferProperty
-
bufferAnyProperty
-
bufferMapProperty
-
bufferAnyParameterProperty
-
bufferMergingProperty
-