use of com.alibaba.json.test.entity.pagemodel.RegionEnum in project fastjson by alibaba.
the class JacksonPageModelParser method parseRegions.
/**
* @param parser
* @param layoutId
* @throws JsonParseException
* @throws IOException
*/
private List<RegionInstance> parseRegions(JsonParser parser, String segment) throws JsonParseException, IOException {
JsonToken current = parser.nextToken();
assertExpectedJsonToken(current, JsonToken.START_ARRAY, parser.getCurrentLocation());
List<RegionInstance> instances = new ArrayList<RegionInstance>();
while ((current = parser.nextToken()) != JsonToken.END_ARRAY) {
assertExpectedJsonToken(current, JsonToken.START_OBJECT, parser.getCurrentLocation());
// get regionId
String regionId = getNextTextValue("cid", parser);
RegionEnum region = RegionEnum.valueOf(regionId);
// move to field: widgtes
current = parser.nextToken();
assertExpectedFiled(parser.getCurrentName(), "widgets", parser.getCurrentLocation());
RegionInstance instance = new RegionInstance();
instance.setWidgtes(parseWidgets(parser, region));
instances.add(instance);
assertExpectedJsonToken((current = parser.nextToken()), JsonToken.END_OBJECT, parser.getCurrentLocation());
}
return instances;
}
Aggregations