Package com.alibaba.fastjson.parser.deserializer

Examples of com.alibaba.fastjson.parser.deserializer.DefaultObjectDeserializer


    public void test_0() throws Exception {
        String input = "{'map':{}}";
        DefaultExtJSONParser parser = new DefaultExtJSONParser(input, ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);

        DefaultObjectDeserializer deser = new DefaultObjectDeserializer();

        Map<String, TreeMap> map = JSON.parseObject(input, new TypeReference<Map<String, TreeMap>>() {
        }.getType());

        Assert.assertTrue(map.get("map") instanceof TreeMap);
View Full Code Here


    public void test_2() throws Exception {
        String input = "{'map':{}}";
        DefaultExtJSONParser parser = new DefaultExtJSONParser(input, ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);

        DefaultObjectDeserializer deser = new DefaultObjectDeserializer();

        SortedMap<String, Map> map = JSON.parseObject(input, new TypeReference<SortedMap<String, Map>>() {
        }.getType());

        Assert.assertEquals(AntiCollisionHashMap.class, map.get("map").getClass());
View Full Code Here

    public void test_3() throws Exception {
        String input = "{'map':{}}";
        DefaultExtJSONParser parser = new DefaultExtJSONParser(input, ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);

        DefaultObjectDeserializer deser = new DefaultObjectDeserializer();

        SortedMap<String, ConcurrentMap> map = JSON.parseObject(input, new TypeReference<SortedMap<String, ConcurrentMap>>() {
        }.getType());

        Assert.assertEquals(ConcurrentHashMap.class, map.get("map").getClass());
View Full Code Here

    public void test_4() throws Exception {
        String input = "{'map':{}}";
        DefaultExtJSONParser parser = new DefaultExtJSONParser(input, ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);

        DefaultObjectDeserializer deser = new DefaultObjectDeserializer();

        SortedMap<String, HashMap> map = JSON.parseObject(input, new TypeReference<SortedMap<String, HashMap>>() {
        }.getType());

        Assert.assertEquals(HashMap.class, map.get("map").getClass());
View Full Code Here

    public void test_5() throws Exception {
        String input = "{'map':{}}";
        DefaultExtJSONParser parser = new DefaultExtJSONParser(input, ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);

        DefaultObjectDeserializer deser = new DefaultObjectDeserializer();

        HashMap<String, HashMap> map = JSON.parseObject(input, new TypeReference<HashMap<String, HashMap>>() {
        }.getType());

        Assert.assertEquals(HashMap.class, map.get("map").getClass());
View Full Code Here

    public void test_6() throws Exception {
        String input = "{'map':{}}";
        DefaultExtJSONParser parser = new DefaultExtJSONParser(input, ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);

        DefaultObjectDeserializer deser = new DefaultObjectDeserializer();

        Map map = JSON.parseObject(input, new TypeReference<JSONObject>() {
        }.getType());

        Assert.assertEquals(JSONObject.class, map.get("map").getClass());
View Full Code Here

    public void test_7() throws Exception {
        String input = "{'map':{}}";
        DefaultExtJSONParser parser = new DefaultExtJSONParser(input, ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);

        DefaultObjectDeserializer deser = new DefaultObjectDeserializer();

        TreeMap<String, HashMap> map = JSON.parseObject(input, new TypeReference<TreeMap<String, HashMap>>() {
        }.getType());

        Assert.assertEquals(HashMap.class, map.get("map").getClass());
View Full Code Here

    public void test_error() throws Exception {
        String input = "{'map':{}}";
        DefaultExtJSONParser parser = new DefaultExtJSONParser(input, ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);

        DefaultObjectDeserializer deser = new DefaultObjectDeserializer();

        Object val = null;
        Exception error = null;
        try {
            val = JSON.parseObject(input, new TypeReference<Map1<String, HashMap>>() {
View Full Code Here

        int featureValues = 0;
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{", ParserConfig.getGlobalInstance(), featureValues);
        parser.config(Feature.AllowUnQuotedFieldNames, true);

        Entity object = new Entity();
        DefaultObjectDeserializer objectDeser = new DefaultObjectDeserializer();
        Exception error = null;
        try {
        objectDeser.parseObject(parser, object);
        } catch (JSONException ex) {
            error = ex;
        }
        Assert.assertNotNull(error);
    }
View Full Code Here

        int featureValues = 0;
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{\"value\":null", ParserConfig.getGlobalInstance(), featureValues);
        parser.config(Feature.AllowUnQuotedFieldNames, true);

        Entity object = new Entity();
        DefaultObjectDeserializer objectDeser = new DefaultObjectDeserializer();
        Exception error = null;
        try {
        objectDeser.parseObject(parser, object);
        } catch (JSONException ex) {
            error = ex;
        }
        Assert.assertNotNull(error);
    }
View Full Code Here

TOP

Related Classes of com.alibaba.fastjson.parser.deserializer.DefaultObjectDeserializer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.