use of com.alibaba.json.test.entity.pagemodel.LayoutInstance in project fastjson by alibaba.
the class JacksonPageModelParser method parseLayouts.
/**
* @param parser
* @param segmentId
* @throws JsonParseException
* @throws IOException
*/
private List<LayoutInstance> parseLayouts(JsonParser parser, String segment) throws JsonParseException, IOException {
JsonToken current = parser.nextToken();
assertExpectedJsonToken(current, JsonToken.START_ARRAY, parser.getCurrentLocation());
List<LayoutInstance> layoutInThisSegment = new ArrayList<LayoutInstance>();
while ((current = parser.nextToken()) != JsonToken.END_ARRAY) {
assertExpectedJsonToken(current, JsonToken.START_OBJECT, parser.getCurrentLocation());
// get
String instanceId = getNextTextValue("sid", parser);
// instanceId
// get
String layoutId = getNextTextValue("cid", parser);
// layoutId
LayoutInstance layoutInstance = new LayoutInstance();
layoutInstance.setCid(layoutId);
layoutInstance.setSid(Long.valueOf(instanceId));
layoutInThisSegment.add(layoutInstance);
// move to field: regions
current = parser.nextToken();
assertExpectedFiled(parser.getCurrentName(), "regions", parser.getCurrentLocation());
layoutInstance.setRegions(parseRegions(parser, segment));
assertExpectedJsonToken((current = parser.nextToken()), JsonToken.END_OBJECT, parser.getCurrentLocation());
}
return layoutInThisSegment;
}
Aggregations