Package com.google.gson

Examples of com.google.gson.JsonNull


        }

        @Override
        public JsonElement serialize(List<PortConfig> src, Type typeOfSrc, JsonSerializationContext context) {
            if (src.size() == 0) {
                return new JsonNull();
            }
            JsonArray array = new JsonArray();
            for (PortConfig pc : src) {
                array.add(s_gson.toJsonTree(pc));
            }
View Full Code Here


     * @return JsonElement with key/value(s) pairs or JsonNull if metadata is null.
     */
    @Override
    public JsonElement serialize(Metadata metadata, Type type, JsonSerializationContext context) {
        if (metadata == null){
            return new JsonNull();
        }
        String[] names = getNames(metadata);
        if (names == null) {
            return new JsonNull();
        }

        JsonObject root = new JsonObject();

        for (String n : names) {
View Full Code Here

        return retval;
    }
   
    private JsonElement asJsonValue(Object value) {
        if (value == null) {
            return new JsonNull();
        } else if (value.getClass().isArray()) {
            Object[] arr = (Object[]) value;
            JsonArray retval = new JsonArray();
            for (Object sub : arr) {
                retval.add(asJsonValue(sub));
View Full Code Here

                JsonSerializationContext context) {
            JsonObject obj = new JsonObject();
            obj.add("to", context.serialize(objref.getReferredName()));
            JsonElement js_attr;
            if (objref.getAttr() == null) {
                js_attr = new JsonNull();
            } else {
                js_attr = context.serialize(objref.getAttr());
            }
            obj.add("attr", js_attr);
            obj.addProperty("href", objref.getHRef());
View Full Code Here

TOP

Related Classes of com.google.gson.JsonNull

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.