public class PropertyValueBuffer extends Object
PropertyValue
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.Modifier and Type | Field and Description |
---|---|
protected PropertyValue |
_buffered
If we get non-creator parameters before or between
creator parameters, those need to be buffered.
|
protected DeserializationContext |
_context |
protected Object[] |
_creatorParameters
Buffer used for storing creator parameters for constructing
instance.
|
protected 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 BitSet |
_paramsSeenBig
Bitflag used to track parameters found from incoming data
when number of parameters is
32 or higher.
|
protected JsonParser |
_parser |
Constructor and Description |
---|
PropertyValueBuffer(JsonParser p,
DeserializationContext ctxt,
int paramCount,
ObjectIdReader oir) |
Modifier and Type | Method and Description |
---|---|
protected Object |
_findMissing(SettableBeanProperty prop) |
boolean |
assignParameter(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.
|
void |
bufferAnyProperty(SettableAnyProperty prop,
String propName,
Object value) |
protected PropertyValue |
buffered() |
void |
bufferMapProperty(Object key,
Object value) |
void |
bufferProperty(SettableBeanProperty prop,
Object value) |
Object |
getParameter(SettableBeanProperty prop)
A variation of
getParameters(SettableBeanProperty[]) that
accepts a single property. |
Object[] |
getParameters(SettableBeanProperty[] props)
Method called to do necessary post-processing such as injection of values
and verification of values for required properties,
after either
assignParameter(SettableBeanProperty, Object)
returns true (to indicate all creator properties are found), or when
then whole JSON Object has been processed, |
Object |
handleIdValue(DeserializationContext ctxt,
Object bean)
Helper method called to handle Object Id value collected earlier, if any
|
boolean |
hasParameter(SettableBeanProperty prop)
Returns
true if the given property was seen in the JSON source by
this buffer. |
boolean |
isComplete() |
boolean |
readIdProperty(String propName)
Helper method called to see if given non-creator property is the "id property";
and if so, handle appropriately.
|
protected final JsonParser _parser
protected final DeserializationContext _context
protected final ObjectIdReader _objectIdReader
protected final Object[] _creatorParameters
protected int _paramsNeeded
protected int _paramsSeen
protected final BitSet _paramsSeenBig
protected PropertyValue _buffered
protected Object _idValue
public PropertyValueBuffer(JsonParser p, DeserializationContext ctxt, int paramCount, ObjectIdReader oir)
public final boolean hasParameter(SettableBeanProperty prop)
true
if the given property was seen in the JSON source by
this buffer.public Object getParameter(SettableBeanProperty prop) throws JsonMappingException
getParameters(SettableBeanProperty[])
that
accepts a single property. Whereas the plural form eagerly fetches and
validates all properties, this method may be used (along with
hasParameter(SettableBeanProperty)
) to let applications only
fetch the properties defined in the JSON source itself, and to have some
other customized behavior for missing properties.JsonMappingException
public Object[] getParameters(SettableBeanProperty[] props) throws JsonMappingException
assignParameter(SettableBeanProperty, Object)
returns true
(to indicate all creator properties are found), or when
then whole JSON Object has been processed,JsonMappingException
protected Object _findMissing(SettableBeanProperty prop) throws JsonMappingException
JsonMappingException
public boolean readIdProperty(String propName) throws IOException
IOException
public Object handleIdValue(DeserializationContext ctxt, Object bean) throws IOException
IOException
protected PropertyValue buffered()
public boolean isComplete()
public boolean assignParameter(SettableBeanProperty prop, Object value)
public void bufferProperty(SettableBeanProperty prop, Object value)
public void bufferAnyProperty(SettableAnyProperty prop, String propName, Object value)
Copyright © 2020 JBoss by Red Hat. All rights reserved.