Package com.alibaba.fastjson.parser

Examples of com.alibaba.fastjson.parser.DefaultExtJSONParser


        A a = parser.parseObject(A.class);
        Assert.assertEquals(true, a.getO1() != null);
    }

    public void test_4() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{v5:'3'}");
        parser.config(Feature.AllowUnQuotedFieldNames, true);
        parser.config(Feature.AllowSingleQuotes, true);
        A a = parser.parseObject(A.class);
        Assert.assertEquals(3L, a.getV5().longValue());
    }
View Full Code Here


        A a = parser.parseObject(A.class);
        Assert.assertEquals(3L, a.getV5().longValue());
    }

    public void test_5() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{v5:\"3\"}");
        parser.config(Feature.AllowUnQuotedFieldNames, true);
        parser.config(Feature.AllowSingleQuotes, true);
        A a = parser.parseObject(A.class);
        Assert.assertEquals(3L, a.getV5().longValue());
    }
View Full Code Here

        int features = JSON.DEFAULT_PARSER_FEATURE;
        features = Feature.config(features, Feature.AllowSingleQuotes, true);

        Assert.assertEquals(true, Feature.isEnabled(features, Feature.AllowSingleQuotes));

        DefaultExtJSONParser parser = new DefaultExtJSONParser("'abc'", ParserConfig.getGlobalInstance(), features);

        Assert.assertEquals("abc", parser.parse());
    }
View Full Code Here

        Assert.assertEquals("abc", parser.parse());
    }

    public void test_7() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("123");

        ParserConfig mapping = new ParserConfig();
        parser.setConfig(mapping);
        Assert.assertEquals(mapping, parser.getConfig());
    }
View Full Code Here

import com.alibaba.json.bvt.parser.DefaultExtJSONParserTest.User;

public class DefaultExtJSONParserTest_2 extends TestCase {

    public void test_0() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{'a':3}");
        parser.config(Feature.AllowSingleQuotes, true);
        A a = parser.parseObject(A.class);
        Assert.assertEquals(3, a.getA());
    }
View Full Code Here

        A a = parser.parseObject(A.class);
        Assert.assertEquals(3, a.getA());
    }

    public void test_1() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{a:3}");
        parser.config(Feature.AllowUnQuotedFieldNames, true);
        A a = parser.parseObject(A.class);
        Assert.assertEquals(3, a.getA());
    }
View Full Code Here

        A a = parser.parseObject(A.class);
        Assert.assertEquals(3, a.getA());
    }

    public void test_2() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{a:3}");
        parser.config(Feature.AllowUnQuotedFieldNames, true);
        Map a = parser.parseObject(Map.class);
        Assert.assertEquals(3, a.get("a"));
    }
View Full Code Here

        Map a = parser.parseObject(Map.class);
        Assert.assertEquals(3, a.get("a"));
    }

    public void test_3() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{a:3}");
        parser.config(Feature.AllowUnQuotedFieldNames, true);
        HashMap a = parser.parseObject(HashMap.class);
        Assert.assertEquals(3, a.get("a"));
    }
View Full Code Here

        HashMap a = parser.parseObject(HashMap.class);
        Assert.assertEquals(3, a.get("a"));
    }

    public void test_4() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{a:3}");
        parser.config(Feature.AllowUnQuotedFieldNames, true);
        LinkedHashMap a = parser.parseObject(LinkedHashMap.class);
        Assert.assertEquals(3, a.get("a"));
    }
View Full Code Here

        }

        ParserConfig config = new ParserConfig();
        config.setAsmEnable(false);

        DefaultExtJSONParser parser = new DefaultExtJSONParser(input, config, featureValues);
        T value = (T) parser.parseObject(clazz);

        if (clazz != JSONArray.class) {
            parser.close();
        }

        return (T) value;
    }
View Full Code Here

TOP

Related Classes of com.alibaba.fastjson.parser.DefaultExtJSONParser

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.