Examples of JsonSet


Examples of com.alibaba.fastjson.support.odps.udf.JSONSet

import com.alibaba.fastjson.support.odps.udf.JSONSet;


public class JSONSetTest extends TestCase {
    public void test_udf() throws Exception {
        JSONSet udf = new JSONSet();
       
        String text = udf.evaluate("[0,1,2]", "$[1]", new Long(123));
        Assert.assertEquals("[0,123,2]", text);
    }
View Full Code Here

Examples of com.alibaba.fastjson.support.odps.udf.JSONSet

        String text = udf.evaluate("[0,1,2]", "$[1]", new Long(123));
        Assert.assertEquals("[0,123,2]", text);
    }
   
    public void test_double() throws Exception {
        JSONSet udf = new JSONSet();
       
        String text = udf.evaluate("[1,2,3]", "[0]", 123.2D);
        Assert.assertEquals("[123.2,2,3]", text);
    }
View Full Code Here

Examples of com.github.jsonj.JsonSet

    /**
     * @return an empty JsonSet
     */
    public static JsonSet set() {
        return new JsonSet();
    }
View Full Code Here

Examples of com.github.jsonj.JsonSet

    /**
     * @param elements elements
     * @return json set with all the elements added
     */
    public static JsonSet set(final JsonElement... elements) {
        JsonSet jjArray = new JsonSet();
        for (JsonElement jjElement : elements) {
            if(jjElement==null) {
                jjArray.add(nullValue());
            } else {
                jjArray.add(jjElement);
            }
        }
        return jjArray;
    }
View Full Code Here

Examples of com.github.jsonj.JsonSet

     *
     * @param c an existing collection. If the elements are JsonElements, they will be added. Otherwise, primitive will be called on them.
     * @return json array with the collection elements in it
     */
    public static JsonSet set(Iterable<?> c) {
        JsonSet jjArray = new JsonSet();
        if(c instanceof JsonElement) {
            jjArray.add((JsonArray)c);
        } else {
            for (Object o : c) {
                if (o instanceof JsonElement) {
                    jjArray.add((JsonElement) o);
                } else {
                    jjArray.add(primitive(o));
                }
            }
        }
        return jjArray;
    }
View Full Code Here

Examples of com.github.jsonj.JsonSet

    /**
     * @param elements strings
     * @return json array with all the elements added as JsonPrimitive
     */
    public static JsonSet set(final String... elements) {
        JsonSet jjSet = new JsonSet();
        for (String s : elements) {
            jjSet.add(primitive(s));
        }
        return jjSet;
    }
View Full Code Here

Examples of com.github.jsonj.JsonSet

        }
        return jjSet;
    }

    public static <T> JsonSet set(T[] array) {
        JsonSet set = new JsonSet();
        for(T e: array) {
            set.add(fromObject(e));
        }
        return set;
    }
View Full Code Here

Examples of com.github.jsonj.JsonSet

        }
        return set;
    }

    public static JsonSet set(int[] array) {
        JsonSet set = new JsonSet();
        for(int e: array) {
            set.add(e);
        }
        return set;
    }
View Full Code Here

Examples of com.github.jsonj.JsonSet

        }
        return set;
    }

    public static JsonSet set(long[] array) {
        JsonSet set = new JsonSet();
        for(long e: array) {
            set.add(e);
        }
        return set;
    }
View Full Code Here

Examples of com.github.jsonj.JsonSet

        }
        return set;
    }

    public static JsonSet set(float[] array) {
        JsonSet set = new JsonSet();
        for(float e: array) {
            set.add(e);
        }
        return set;
    }
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.