Search in sources :

Example 1 with PageInstance

use of com.alibaba.json.test.entity.pagemodel.PageInstance in project fastjson by alibaba.

the class JacksonPageModelParser method parse.

/**
     * @param content
     * @throws JsonParseException
     * @throws IOException
     */
public PageInstance parse(String content) throws JsonParseException, IOException {
    JsonFactory f = new JsonFactory();
    JsonParser parser = f.createJsonParser(content);
    // move to the start of the
    JsonToken current = parser.nextToken();
    // object
    // get instanceId
    String instanceId = getNextTextValue("sid", parser);
    // get pageId
    String pageId = getNextTextValue("cid", parser);
    // move to field: segments
    current = parser.nextToken();
    assertExpectedFiled(parser.getCurrentName(), "segments", parser.getCurrentLocation());
    PageInstance pageInstance = new PageInstance();
    pageInstance.setCid(pageId);
    pageInstance.setSid(Long.valueOf(instanceId));
    pageInstance.setSegments(parseSegments(parser));
    return pageInstance;
// 构建组件树,用于递归渲染
// pageInstance.buildComponentTree();
}
Also used : JsonFactory(com.fasterxml.jackson.core.JsonFactory) JsonToken(com.fasterxml.jackson.core.JsonToken) JsonParserHelper.assertExpectedJsonToken(com.alibaba.json.test.performance.JacksonPageModelParser.JsonParserHelper.assertExpectedJsonToken) PageInstance(com.alibaba.json.test.entity.pagemodel.PageInstance) JsonParser(com.fasterxml.jackson.core.JsonParser)

Aggregations

PageInstance (com.alibaba.json.test.entity.pagemodel.PageInstance)1 JsonParserHelper.assertExpectedJsonToken (com.alibaba.json.test.performance.JacksonPageModelParser.JsonParserHelper.assertExpectedJsonToken)1 JsonFactory (com.fasterxml.jackson.core.JsonFactory)1 JsonParser (com.fasterxml.jackson.core.JsonParser)1 JsonToken (com.fasterxml.jackson.core.JsonToken)1