use of com.alibaba.fastjson.parser.deserializer.ContextObjectDeserializer in project fastjson by alibaba.
the class DefaultFieldDeserializerBug569 method parseField.
@Override
public void parseField(DefaultJSONParser parser, Object object, Type objectType, Map<String, Object> fieldValues) {
if (fieldValueDeserilizer == null) {
getFieldValueDeserilizer(parser.getConfig());
}
Type fieldType = fieldInfo.fieldType;
if (objectType instanceof ParameterizedType) {
ParseContext objContext = parser.getContext();
objContext.type = objectType;
fieldType = FieldInfo.getFieldType(this.clazz, objectType, fieldType);
}
// ContextObjectDeserializer
Object value;
if (fieldValueDeserilizer instanceof JavaBeanDeserializer) {
JavaBeanDeserializer javaBeanDeser = (JavaBeanDeserializer) fieldValueDeserilizer;
value = javaBeanDeser.deserialze(parser, fieldType, fieldInfo.name, fieldInfo.parserFeatures);
} else {
if (this.fieldInfo.format != null && fieldValueDeserilizer instanceof ContextObjectDeserializer) {
value = //
((ContextObjectDeserializer) fieldValueDeserilizer).deserialze(parser, fieldType, fieldInfo.name, fieldInfo.format, fieldInfo.parserFeatures);
} else {
value = fieldValueDeserilizer.deserialze(parser, fieldType, fieldInfo.name);
}
}
if (parser.getResolveStatus() == DefaultJSONParser.NeedToResolve) {
DefaultJSONParser.ResolveTask task = parser.getLastResolveTask();
task.fieldDeserializer = this;
task.ownerContext = parser.getContext();
parser.setResolveStatus(DefaultJSONParser.NONE);
} else {
if (object == null) {
fieldValues.put(fieldInfo.name, value);
} else {
setValue(object, value);
}
}
}
Aggregations