/** * Method called when starting to build a bean instance. * * @since 2.1 (added ObjectIdReader parameter -- existed in previous versions without) */ public PropertyValueBuffer startBuilding(JsonParser p, DeserializationContext ctxt, ObjectIdReader oir) { return new PropertyValueBuffer(p, ctxt, _propertyCount, oir); }
if (buffer.assignParameter(creatorProp, _deserializeWithErrorWrapping(p, ctxt, creatorProp))) { if (buffer.readIdProperty(propName)) { continue; buffer.bufferProperty(prop, prop.deserialize(p, ctxt)); continue; buffer.bufferAnyProperty(_anySetter, propName, _anySetter.deserialize(p, ctxt));
if (prop != null) { if (buffer.assignParameter(prop, prop.deserialize(p, ctxt))) { return null; buffer.bufferMapProperty(actualKey, value);
public Object build(DeserializationContext ctxt, PropertyValueBuffer buffer) throws IOException { Object bean = _valueInstantiator.createFromObjectWith(ctxt, _allProperties, buffer); // returning null isn't quite legal, but let's let caller deal with that if (bean != null) { // Object Id to handle? bean = buffer.handleIdValue(ctxt, bean); // Anything buffered? for (PropertyValue pv = buffer.buffered(); pv != null; pv = pv.next) { pv.assign(bean); } } return bean; }
protected Object deserializeEnumUsingPropertyBased(final JsonParser p, final DeserializationContext ctxt, final PropertyBasedCreator creator) throws IOException { PropertyValueBuffer buffer = creator.startBuilding(p, ctxt, null); JsonToken t = p.getCurrentToken(); for (; t == JsonToken.FIELD_NAME; t = p.nextToken()) { String propName = p.getCurrentName(); p.nextToken(); // to point to value SettableBeanProperty creatorProp = creator.findCreatorProperty(propName); if (creatorProp != null) { buffer.assignParameter(creatorProp, _deserializeWithErrorWrapping(p, ctxt, creatorProp)); continue; } if (buffer.readIdProperty(propName)) { continue; } } return creator.build(ctxt, buffer); }
/** * A variation of {@link #getParameters(SettableBeanProperty[])} that * accepts a single property. Whereas the plural form eagerly fetches and * validates all properties, this method may be used (along with * {@link #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. * * @since 2.8 */ public Object getParameter(SettableBeanProperty prop) throws JsonMappingException { Object value; if (hasParameter(prop)) { value = _creatorParameters[prop.getCreatorIndex()]; } else { value = _creatorParameters[prop.getCreatorIndex()] = _findMissing(prop); } if (value == null && _context.isEnabled(DeserializationFeature.FAIL_ON_NULL_CREATOR_PROPERTIES)) { return _context.reportInputMismatch(prop, "Null value for creator property '%s' (index %d); `DeserializationFeature.FAIL_ON_NULL_FOR_CREATOR_PARAMETERS` enabled", prop.getName(), prop.getCreatorIndex()); } return value; }
if (creatorProp != null) { if (buffer.assignParameter(creatorProp, creatorProp.deserialize(p, ctxt))) { try { builder = creator.build(ctxt, buffer); if (buffer.readIdProperty(propName)) { continue; buffer.bufferProperty(prop, prop.deserialize(p, ctxt));
if (buffer.assignParameter(creatorProp.getPropertyIndex(), value)) { buffer.bufferProperty(prop, prop.deserialize(jp, ctxt)); continue; buffer.bufferAnyProperty(_anySetter, propName, _anySetter.deserialize(jp, ctxt));
public Object build(DeserializationContext ctxt, PropertyValueBuffer buffer) throws IOException { Object bean = _valueInstantiator.createFromObjectWith(ctxt, buffer.getParameters(_defaultValues)); // Object Id to handle? bean = buffer.handleIdValue(ctxt, bean); // Anything buffered? for (PropertyValue pv = buffer.buffered(); pv != null; pv = pv.next) { pv.assign(bean); } return bean; } }
/** * Method called when starting to build a bean instance. */ public PropertyValueBuffer startBuilding(JsonParser jp, DeserializationContext ctxt) { PropertyValueBuffer buffer = new PropertyValueBuffer(jp, ctxt, _propertyCount); if (_propertiesWithInjectables != null) { buffer.inject(_propertiesWithInjectables); } return buffer; }
public Object build(DeserializationContext ctxt, PropertyValueBuffer buffer) throws IOException { Object bean = _valueInstantiator.createFromObjectWith(ctxt, buffer.getParameters(_defaultValues)); // Anything buffered? for (PropertyValue pv = buffer.buffered(); pv != null; pv = pv.next) { pv.assign(bean); } return bean; } }
buffer.assignParameter(prop, values[i]); tb.close(); buffer.assignParameter(typeProp, v);
/** * Method that delegates to * {@link #createFromObjectWith(DeserializationContext, Object[])} by * default, but can be overridden if the application should have customized * behavior with respect to missing properties. *<p> * The default implementation of this method uses * {@link PropertyValueBuffer#getParameters(SettableBeanProperty[])} to read * and validate all properties in bulk, possibly substituting defaults for * missing properties or throwing exceptions for missing properties. An * overridden implementation of this method could, for example, use * {@link PropertyValueBuffer#hasParameter(SettableBeanProperty)} and * {@link PropertyValueBuffer#getParameter(SettableBeanProperty)} to safely * read the present properties only, and to have some other behavior for the * missing properties. * * @since 2.8 */ public Object createFromObjectWith(DeserializationContext ctxt, SettableBeanProperty[] props, PropertyValueBuffer buffer) throws IOException { return createFromObjectWith(ctxt, buffer.getParameters(props)); }
_creatorParameters[ix] = _findMissing(props[ix]); final int len = _creatorParameters.length; for (int ix = 0; (ix = _paramsSeenBig.nextClearBit(ix)) < len; ++ix) { _creatorParameters[ix] = _findMissing(props[ix]);
if (creatorProp != null) { if (buffer.assignParameter(creatorProp, creatorProp.deserialize(p, ctxt))) { try { bean = creator.build(ctxt, buffer); if (buffer.readIdProperty(propName)) { continue; buffer.bufferProperty(prop, prop.deserialize(p, ctxt));
if (buffer.assignParameter(creatorProp.getPropertyIndex(), value)) { buffer.bufferProperty(prop, prop.deserialize(jp, ctxt)); continue; buffer.bufferAnyProperty(_anySetter, propName, _anySetter.deserialize(jp, ctxt));
public Object build(DeserializationContext ctxt, PropertyValueBuffer buffer) throws IOException { Object bean = _valueInstantiator.createFromObjectWith(ctxt, buffer.getParameters(_defaultValues)); // Object Id to handle? bean = buffer.handleIdValue(ctxt, bean); // Anything buffered? for (PropertyValue pv = buffer.buffered(); pv != null; pv = pv.next) { pv.assign(bean); } return bean; } }
public Object build(DeserializationContext ctxt, PropertyValueBuffer buffer) throws IOException { Object bean = _valueInstantiator.createFromObjectWith(ctxt, _allProperties, buffer); // returning null isn't quite legal, but let's let caller deal with that if (bean != null) { // Object Id to handle? bean = buffer.handleIdValue(ctxt, bean); // Anything buffered? for (PropertyValue pv = buffer.buffered(); pv != null; pv = pv.next) { pv.assign(bean); } } return bean; }
protected Object deserializeEnumUsingPropertyBased(final JsonParser p, final DeserializationContext ctxt, final PropertyBasedCreator creator) throws IOException { PropertyValueBuffer buffer = creator.startBuilding(p, ctxt, null); JsonToken t = p.getCurrentToken(); for (; t == JsonToken.FIELD_NAME; t = p.nextToken()) { String propName = p.getCurrentName(); p.nextToken(); // to point to value SettableBeanProperty creatorProp = creator.findCreatorProperty(propName); if (creatorProp != null) { buffer.assignParameter(creatorProp, _deserializeWithErrorWrapping(p, ctxt, creatorProp)); continue; } if (buffer.readIdProperty(propName)) { continue; } } return creator.build(ctxt, buffer); }
/** * Method called when starting to build a bean instance. * * @since 2.1 (added ObjectIdReader parameter -- existed in previous versions without) */ public PropertyValueBuffer startBuilding(JsonParser jp, DeserializationContext ctxt, ObjectIdReader oir) { PropertyValueBuffer buffer = new PropertyValueBuffer(jp, ctxt, _propertyCount, oir); if (_propertiesWithInjectables != null) { buffer.inject(_propertiesWithInjectables); } return buffer; }