Examples of Gson


Examples of com.google.gson.Gson

        flat.put("following", following);
        flat.put("likes", likes);
        flat.put("blogs", blogs);
        flat.put("default_post_format", default_post_format);

        Gson gson = new Gson();
        user = gson.fromJson(flatSerialize(flat), User.class);
    }
View Full Code Here

Examples of com.google.gson.Gson

        flat.put("type", "photo");
        flat.put("caption", caption);
        flat.put("width", width);
        flat.put("height", height);
        flat.put("photos", photos);
        Gson gson = new GsonBuilder().registerTypeAdapter(Post.class, new PostDeserializer()).create();
        post = (PhotoPost) gson.fromJson(flatSerialize(flat), Post.class);
    }
View Full Code Here

Examples of com.google.gson.Gson

    userData.put("variables", getTemplates("variables"));
    userData.put("snippets", getTemplates("snippets"));
    userData.put("abbreviations", getTemplates("abbreviations"));
    userData.put("profiles", OutputProfile.allProfiles());
   
    Gson gson = new Gson();
    String payload = gson.toJson(userData);
    ctx.execJSFunction("javaLoadUserData", payload);
  }
View Full Code Here

Examples of com.google.gson.Gson

          for (File f : files) {
            extFiles.add(f.getCanonicalPath());
          }
        } catch (Exception e) {}
       
        Gson gson = new Gson();
        ctx.execJSFunction("javaLoadExtensions", gson.toJson(extFiles));
      }
    }
  }
View Full Code Here

Examples of com.google.gson.Gson

  }

  protected String text(String entity, Type type) {
    switch (type) {
    case JSON:
      Gson gson = new Gson();
      return gson.fromJson(entity, Page.class).content;
    case XML:
      XStream xstream = new XStream();
      xstream.alias("page", Page.class);
      xstream.ignoreUnknownElements();
      return ((Page) xstream.fromXML(entity)).content;
View Full Code Here

Examples of com.google.gson.Gson

    page.title = resource.getName();
    page.content = resource.getContent();
    page.parent = resource.getParentName();
    switch (type) {
    case JSON:
      Gson gson = new Gson();
      String json = gson.toJson(page);
      return json;
    case XML:
      page.xmlns = "http://www.xwiki.org";
      XStream xstream = new XStream();
      xstream.alias("page", Page.class);
View Full Code Here

Examples of com.google.gson.Gson

  protected String uri(String rootPath) {
    return format(INDEX_URI, rootPath);
  }

  private Collection<Page> parse(String entity) {
    Gson gson = new Gson();
    return gson.<Collection<Page>> fromJson(
        jsonMember(entity, "pageSummaries"),
        new TypeToken<Collection<Page>>() {
        }.getType());
  }
View Full Code Here

Examples of com.google.gson.Gson

  protected String uri(String rootPath) {
    return format(INDEX_URI, rootPath);
  }

    private Collection<Page> parse(String entity) {
        Gson gson = new Gson();
        return gson.<Collection<Page>> fromJson(jsonMember(entity, "wiki_pages"),
                new TypeToken<Collection<Page>>() {
                }.getType());
    }
View Full Code Here

Examples of com.google.gson.Gson

  }

  protected String text(String entity, Type type) {
    switch (type) {
    case JSON:
      Gson gson = new Gson();
      return gson.fromJson(jsonMember(entity, "wiki_page"),
          WikiPage.class).text;
    case XML:
      XStream xstream = new XStream();
      xstream.alias("wiki_page", WikiPage.class);
      xstream.ignoreUnknownElements();
View Full Code Here

Examples of com.google.gson.Gson

    page.text = resource.getContent();
    Entity entity = new Entity();
    entity.wiki_page = page;
    switch (type) {
    case JSON:
      Gson gson = new Gson();
      return gson.toJson(entity);
    case XML:
    default:
      return resource.getContent();
    }
  }
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.