Package com.alibaba.fastjson.parser

Examples of com.alibaba.fastjson.parser.DefaultExtJSONParser.parseArray()


        Assert.assertEquals(new Integer(1), array[0]);
    }

    public void test_13() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("['1']");
        Object[] array = parser.parseArray(new Type[] { Integer.class });
        Assert.assertEquals(new Integer(1), array[0]);
    }

    public void test_14() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("[]");
View Full Code Here


        Assert.assertEquals(new Integer(1), array[0]);
    }

    public void test_14() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("[]");
        Object[] array = parser.parseArray(new Type[] {});
        Assert.assertEquals(0, array.length);
    }

    public void test_15() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("[1,null]");
View Full Code Here

    public void test_15() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("[1,null]");
        ArrayList list = new ArrayList();
        parser.config(Feature.AllowISO8601DateFormat, false);
        parser.parseArray(String.class, list);
        Assert.assertEquals("1", list.get(0));
        Assert.assertEquals(null, list.get(1));
    }

    public void test_16() throws Exception {
View Full Code Here

    }

    public void test_16() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("[[1]]");
        parser.config(Feature.AllowISO8601DateFormat, false);
        Object[] array = parser.parseArray(new Type[] { new TypeReference<List<Integer>>() {
        }.getType() });
        Assert.assertEquals(new Integer(1), ((List<Integer>) (array[0])).get(0));
    }

    public void test_17() throws Exception {
View Full Code Here

        Assert.assertEquals(new Integer(1), ((List<Integer>) (array[0])).get(0));
    }

    public void test_17() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("[]");
        Object[] array = parser.parseArray(new Type[] { Integer[].class });
        Integer[] values = (Integer[]) array[0];
        Assert.assertEquals(0, values.length);
    }

    public void test_18() throws Exception {
View Full Code Here

    }

    public <T> Collection<T> decodeArray(String text, Class<T> clazz) throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser(text, config);
        parser.config(Feature.DisableCircularReferenceDetect, true);
        return parser.parseArray(clazz);
    }

    public final Object decodeObject(String text) {
        DefaultJSONParser parser = new DefaultJSONParser(text, config);
        parser.config(Feature.DisableCircularReferenceDetect, true);
View Full Code Here

    public <T> Collection<T> decodeArray(String text, Class<T> clazz) throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser(text, config);
        parser.config(Feature.DisableCircularReferenceDetect, true);
        parser.config(Feature.SupportArrayToBean, true);
        return parser.parseArray(clazz);
    }

    public final Object decodeObject(String text) {
        DefaultJSONParser parser = new DefaultJSONParser(text, config);
        parser.config(Feature.DisableCircularReferenceDetect, true);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.