本文整理汇总了Java中com.alibaba.fastjson.parser.DefaultJSONParser.NeedToResolve方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultJSONParser.NeedToResolve方法的具体用法?Java DefaultJSONParser.NeedToResolve怎么用?Java DefaultJSONParser.NeedToResolve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.fastjson.parser.DefaultJSONParser
的用法示例。
在下文中一共展示了DefaultJSONParser.NeedToResolve方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseField
import com.alibaba.fastjson.parser.DefaultJSONParser; //导入方法依赖的package包/类
@Override
public void parseField(DefaultJSONParser parser, Object object, Type objectType, Map<String, Object> fieldValues) {
if (fieldValueDeserilizer == null) {
fieldValueDeserilizer = parser.getConfig().getDeserializer(fieldInfo);
}
if (objectType instanceof ParameterizedType) {
ParseContext objContext = parser.getContext();
objContext.setType(objectType);
}
Object value = fieldValueDeserilizer.deserialze(parser, getFieldType(), fieldInfo.getName());
if (parser.getResolveStatus() == DefaultJSONParser.NeedToResolve) {
ResolveTask task = parser.getLastResolveTask();
task.setFieldDeserializer(this);
task.setOwnerContext(parser.getContext());
parser.setResolveStatus(DefaultJSONParser.NONE);
} else {
if (object == null) {
fieldValues.put(fieldInfo.getName(), value);
} else {
setValue(object, value);
}
}
}
示例2: parseField
import com.alibaba.fastjson.parser.DefaultJSONParser; //导入方法依赖的package包/类
@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);
}
}
}