use of com.alibaba.json.test.entity.pagemodel.SegmentInstance in project fastjson by alibaba.
the class JacksonPageModelParser method parseSegments.
/**
* @param parser
* @throws JsonParseException
* @throws IOException
*/
private List<SegmentInstance> parseSegments(JsonParser parser) throws JsonParseException, IOException {
JsonToken current = parser.nextToken();
assertExpectedJsonToken(current, JsonToken.START_ARRAY, parser.getCurrentLocation());
List<SegmentInstance> instances = new ArrayList<SegmentInstance>();
while ((current = parser.nextToken()) != JsonToken.END_ARRAY) {
assertExpectedJsonToken(current, JsonToken.START_OBJECT, parser.getCurrentLocation());
// get pageId
String segmentId = getNextTextValue("cid", parser);
// move to field: layouts
current = parser.nextToken();
assertExpectedFiled(parser.getCurrentName(), "layouts", parser.getCurrentLocation());
SegmentInstance instance = new SegmentInstance();
instance.setLayouts(parseLayouts(parser, segmentId));
instances.add(instance);
assertExpectedJsonToken((current = parser.nextToken()), JsonToken.END_OBJECT, parser.getCurrentLocation());
}
return instances;
}
Aggregations