@SuppressWarnings("unchecked")
public Map<Object,Object> _deserializeUsingCreator(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException
{
final PropertyBasedCreator creator = _propertyBasedCreator;
PropertyValueBuffer buffer = creator.startBuilding(jp, ctxt);
JsonToken t = jp.getCurrentToken();
if (t == JsonToken.START_OBJECT) {
t = jp.nextToken();
}
final JsonDeserializer<Object> valueDes = _valueDeserializer;
final TypeDeserializer typeDeser = _valueTypeDeserializer;
for (; t == JsonToken.FIELD_NAME; t = jp.nextToken()) {
String propName = jp.getCurrentName();
t = jp.nextToken(); // to get to value
if (_ignorableProperties != null && _ignorableProperties.contains(propName)) {
jp.skipChildren(); // and skip it (in case of array/object)
continue;
}
// creator property?
SettableBeanProperty prop = creator.findCreatorProperty(propName);
if (prop != null) {
// Last property to set?
Object value = prop.deserialize(jp, ctxt);
if (buffer.assignParameter(prop.getPropertyIndex(), value)) {
jp.nextToken();
Map<Object,Object> result;
try {
result = (Map<Object,Object>)creator.build(buffer);
} catch (Exception e) {
wrapAndThrow(e, _mapType.getRawClass());
return null;
}
_readAndBind(jp, ctxt, result);
return result;
}
continue;
}
// other property? needs buffering
String fieldName = jp.getCurrentName();
Object key = _keyDeserializer.deserializeKey(fieldName, ctxt);
Object value;
if (t == JsonToken.VALUE_NULL) {
value = null;
} else if (typeDeser == null) {
value = valueDes.deserialize(jp, ctxt);
} else {
value = valueDes.deserializeWithType(jp, ctxt, typeDeser);
}
buffer.bufferMapProperty(key, value);
}
// end of JSON object?
// if so, can just construct and leave...
try {
return (Map<Object,Object>)creator.build(buffer);