final Object bean = _valueInstantiator.createUsingDefault();
if (_injectables != null) {
injectValues(ctxt, bean);
}
JsonToken t = jp.getCurrentToken();
SettableBeanProperty prop = _orderedProperties[0];
// First: verify that first name is expected
if (t == JsonToken.START_OBJECT) {
if (!jp.nextFieldName(_orderedPropertyNames[0])) {
return super.deserialize(jp, ctxt, bean);
}
t = jp.nextToken();
} else if (t != JsonToken.FIELD_NAME || !prop.getName().equals(jp.getCurrentName())) {
return super.deserialize(jp, ctxt, bean);
}
// and deserialize
jp.nextToken();
try {
prop.deserializeAndSet(jp, ctxt, bean);
} catch (Exception e) {
wrapAndThrow(e, bean, prop.getName(), ctxt);
}
// then rest of properties
for (int i = 1, len = _orderedProperties.length; i < len; ++i) {
prop = _orderedProperties[i];
if (!jp.nextFieldName(_orderedPropertyNames[i])) { // miss...
if (jp.getCurrentToken() == JsonToken.END_OBJECT) {
break;
}
// we likely point to FIELD_NAME, so can just call parent impl
return super.deserialize(jp, ctxt, bean);
}
jp.nextToken(); // skip field, returns value token
try {
prop.deserializeAndSet(jp, ctxt, bean);
} catch (Exception e) {
wrapAndThrow(e, bean, prop.getName(), ctxt);
}
}
// also, need to ensure we get closing END_OBJECT...
if (jp.nextToken() != JsonToken.END_OBJECT) {
return super.deserialize(jp, ctxt, bean);