本文整理汇总了Java中com.alibaba.fastjson.parser.DefaultJSONParser.ResolveTask.getReferenceValue方法的典型用法代码示例。如果您正苦于以下问题:Java ResolveTask.getReferenceValue方法的具体用法?Java ResolveTask.getReferenceValue怎么用?Java ResolveTask.getReferenceValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.fastjson.parser.DefaultJSONParser.ResolveTask
的用法示例。
在下文中一共展示了ResolveTask.getReferenceValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleResovleTask
import com.alibaba.fastjson.parser.DefaultJSONParser.ResolveTask; //导入方法依赖的package包/类
public static void handleResovleTask(DefaultJSONParser parser, Object value) {
List<ResolveTask> resolveTaskList = parser.getResolveTaskListDirect();
if (resolveTaskList == null) {
return;
}
int size = resolveTaskList.size();
for (int i = 0; i < size; ++i) {
ResolveTask task = resolveTaskList.get(i);
FieldDeserializer fieldDeser = task.getFieldDeserializer();
if (fieldDeser == null) {
continue;
}
Object object = null;
if (task.getOwnerContext() != null) {
object = task.getOwnerContext().getObject();
}
String ref = task.getReferenceValue();
Object refValue;
if (ref.startsWith("$")) {
refValue = parser.getObject(ref);
} else {
refValue = task.getContext().getObject();
}
fieldDeser.setValue(object, refValue);
}
}
示例2: handleResovleTask
import com.alibaba.fastjson.parser.DefaultJSONParser.ResolveTask; //导入方法依赖的package包/类
public static <T> int handleResovleTask(DefaultJSONParser parser, T value) {
if (parser.isEnabled(Feature.DisableCircularReferenceDetect)) {
return 0;
}
int size = parser.getResolveTaskList().size();
for (int i = 0; i < size; ++i) {
ResolveTask task = parser.getResolveTaskList().get(i);
FieldDeserializer fieldDeser = task.getFieldDeserializer();
Object object = null;
if (task.getOwnerContext() != null) {
object = task.getOwnerContext().getObject();
}
String ref = task.getReferenceValue();
Object refValue;
if (ref.startsWith("$")) {
refValue = parser.getObject(ref);
} else {
refValue = task.getContext().getObject();
}
fieldDeser.setValue(object, refValue);
}
return size;
}