Java 类org.json.simple.parser.ContainerFactory 实例源码

项目:vitus-elasticsearch-webintegration    文件:JsonSupport.java   
private ContainerFactory createContainerFactory() {
    return new ContainerFactory() {
        @Override
        public Map createObjectContainer() {
            return new LinkedHashMap();
        }

        @Override
        public List creatArrayContainer() {
            return new LinkedList();
        }
    };
}
项目:jcoSon    文件:jcoSon.java   
private void createJsonParser()
{
    this.parser = new JSONParser();
    containerFactory = new ContainerFactory()
    {
        @Override
        public List creatArrayContainer()
        {
          return new LinkedList();
        }
        @Override
        public Map createObjectContainer()
        {
          return new LinkedHashMap();
        }
    };
}
项目:Tank    文件:JsonResponse.java   
@SuppressWarnings({ "rawtypes", "unchecked" })
private void initialize() {

    try {
        JSONParser parser = new JSONParser();
        ContainerFactory containerFactory = new ContainerFactory() {
            public List creatArrayContainer() {
                return new LinkedList();
            }

            public Map createObjectContainer() {
                return new LinkedHashMap();
            }
        };
        if (!StringUtils.isEmpty(this.response)) {
            Object parse = parser.parse(this.response, containerFactory);
            if (parse instanceof List) {
                this.jsonMap = new LinkedHashMap();
            } else {
                this.jsonMap = (Map) parse;
            }
            this.jsonMap.put("root", parse);
        } else {
            this.jsonMap = new HashMap();
        }
    } catch (Exception ex) {
        logger.warn("Unable to parse the response string as a JSON object: " + this.response, ex);
    }
}
项目:mgen    文件:MGenJSONParser.java   
@SuppressWarnings("rawtypes")
private Map createObjectContainer(ContainerFactory containerFactory) {
    if (containerFactory == null)
        return new JSONObject();
    Map m = containerFactory.createObjectContainer();

    if (m == null)
        return new JSONObject();
    return m;
}
项目:mgen    文件:MGenJSONParser.java   
@SuppressWarnings("rawtypes")
private List createArrayContainer(ContainerFactory containerFactory) {
    if (containerFactory == null)
        return new JSONArray();
    List l = containerFactory.creatArrayContainer();

    if (l == null)
        return new JSONArray();
    return l;
}