Package com.google.gson

Examples of com.google.gson.JsonObject.entrySet()


                        components.put(el.getKey(), el);
                    }
                }
                if (root != null && root.has("params") && root.get("params").isJsonObject()) {
                    JsonObject aliasesObj = root.get("params").getAsJsonObject();
                    for (Map.Entry<String, JsonElement> el : aliasesObj.entrySet()) {
                        modules.put(el.getKey(), el);
                    }
                }
                if (root != null && root.has("modules") && root.get("modules").isJsonObject()) {
                    JsonObject aliasesObj = root.get("modules").getAsJsonObject();
View Full Code Here


                        modules.put(el.getKey(), el);
                    }
                }
                if (root != null && root.has("modules") && root.get("modules").isJsonObject()) {
                    JsonObject aliasesObj = root.get("modules").getAsJsonObject();
                    for (Map.Entry<String, JsonElement> el : aliasesObj.entrySet()) {
                        params.put(el.getKey(), el);
                    }
                }

            }
View Full Code Here

            componentsMap = new HashMap<String, String>();
            if (components.size() > 0) {
                for (String key : components.keySet()) {
                    JsonElement el = components.get(key).getValue();
                    JsonObject elArr = el.getAsJsonObject();
                    for (Map.Entry<String, JsonElement> elArrKey : elArr.entrySet()) {
                        if (elArrKey.getKey().toLowerCase().equals("class")) {
                            String className = elArrKey.getValue().getAsString();
                            componentsMap.put(key, className);
                        }
                    }
View Full Code Here

            JsonDeserializationContext context) throws JsonParseException {

        Map<String, String> obj = new HashMap<String, String>();
        JsonObject json = src.getAsJsonObject();
       
        for(Entry<String, JsonElement> entry : json.entrySet()) {
            obj.put(entry.getKey(), entry.getValue().getAsString());
        }
       
        return obj;
    }
View Full Code Here

      if (!arg0.isJsonObject()) {
        throw new JsonParseException(arg0.toString() + " is not Json Object, cannot convert to map");
      }
      JsonObject objs = arg0.getAsJsonObject();
      Map<String, String> map = new HashMap<String ,String>();
      for (Entry<String, JsonElement> e : objs.entrySet()) {
        if (!e.getValue().isJsonPrimitive()) {
          throw new JsonParseException(e.getValue().toString() + " is not a Json primitive," + arg0 + " can not convert to map");
        }
        map.put(e.getKey(), e.getValue().getAsString());
      }
View Full Code Here

    if (value instanceof AbstractAttributeGroup) {
      AbstractAttributeGroup castValue = (AbstractAttributeGroup) value;
      if (!castValue.isEmpty()) {
        if (Boolean.valueOf(PropertyReader.getProperty("output.json.inlineAttributes"))) {
          JsonObject enclosure = castValue.getJSONObject();
          for (Entry<String, JsonElement> entry : enclosure.entrySet()) {
            object.add(entry.getKey(), entry.getValue());
          }
        }
        else {
          object.add(name, castValue.getJSONObject());
View Full Code Here

        JsonArray array = json.getAsJsonArray();
        Iterator<JsonElement> it = array.iterator();
        ArrayList<T> cmds = new ArrayList<T>();
        while (it.hasNext()) {
            JsonObject element = (JsonObject)it.next();
            Map.Entry<String, JsonElement> entry = element.entrySet().iterator().next();

            String name = entry.getKey();
            Class<?> clazz;
            try {
                clazz = Class.forName(name);
View Full Code Here

    @Override
    @SuppressWarnings("unchecked")
    public T deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
    throws JsonParseException {
        JsonObject element = (JsonObject) json;
        Map.Entry<String, JsonElement> entry = element.entrySet().iterator().next();
        String name = entry.getKey();
        Class<?> clazz;
        try {
            clazz = Class.forName(name);
        } catch (ClassNotFoundException e) {
View Full Code Here

    } else {
      result = data.getAsJsonObject();
    }

    Map<ParamsProperty, Object> properties = new HashMap<ParamsProperty, Object>();
    for (Entry<String, JsonElement> parameter : result.entrySet()) {
      ParamsProperty parameterType = ParamsProperty.fromKey(parameter.getKey());
      Object object = null;
      if (parameterType == ParamsProperty.BLIPS) {
        Type blipMapType = new TypeToken<Map<String, BlipData>>(){}.getType();
        object = context.deserialize(parameter.getValue(), blipMapType);
View Full Code Here

        jsonObject.get(RequestProperty.ID.key()).getAsString(),
        getPropertyAsStringThenRemove(parameters, ParamsProperty.WAVE_ID),
        getPropertyAsStringThenRemove(parameters, ParamsProperty.WAVELET_ID),
        getPropertyAsStringThenRemove(parameters, ParamsProperty.BLIP_ID));

    for (Entry<String, JsonElement> parameter : parameters.entrySet()) {
      ParamsProperty parameterType = ParamsProperty.fromKey(parameter.getKey());
      Object object = ctx.deserialize(parameter.getValue(), parameterType.clazz());
      request.addParameter(Parameter.of(parameterType, object));
    }
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.