Examples of GsonBuilder


Examples of com.dotcms.repackage.com.google.gson.GsonBuilder

                    contentlet.setProperty(FileAssetAPI.DESCRIPTION, desc);
                }
                Map<String, String> metaMap = APILocator.getFileAssetAPI().getMetaDataMap(contentlet, binFile);

                if(metaMap!=null) {
                    Gson gson = new GsonBuilder().disableHtmlEscaping().create();
                    contentlet.setProperty(FileAssetAPI.META_DATA_FIELD, gson.toJson(metaMap));
                    contentlet = conFac.save(contentlet);
                    if(!isNewContent){
                        LiveCache.removeAssetFromCache(contentlet);
                        LiveCache.addToLiveAssetToCache(contentlet);
View Full Code Here

Examples of com.google.gson.GsonBuilder

*/
public class GsonFactory
{
   public static Gson createInstance()
   {
      Gson gson = new GsonBuilder()
        .setDateFormat("yyyy-MM-dd HH:mm:ss")
        .registerTypeAdapter(java.sql.Timestamp.class, new SQLDateTypeAdapter())
        .create();
      return gson;
   }
View Full Code Here

Examples of com.google.gson.GsonBuilder

    protected XingUser fetchUser(final Token accessToken) throws Exception {
        final OAuthRequest request = new OAuthRequest(Verb.GET, usersMeUrl);
        oAuthService.signRequest(accessToken, request);
        final Response response = request.send();
        final Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create();
        final Users users = gson.fromJson(response.getBody(), Users.class);
        return users.getUsers().get(0);
    }
View Full Code Here

Examples of com.google.gson.GsonBuilder

        }
        return null;
    }

    public static XingUser fromJson(final String json) {
        final Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create();
        return gson.fromJson(json, XingUser.class);
    }
View Full Code Here

Examples of com.google.gson.GsonBuilder

        this.shortMessageLength = shortMessageLength;
        this.hostname = hostname;
        this.includeFullMDC = includeFullMDC;

        // Init GSON for underscores
        GsonBuilder gsonBuilder = new GsonBuilder();
        gsonBuilder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);
        this.gson = gsonBuilder.create();
        this.patternLayout = new PatternLayout();
        this.patternLayout.setContext(new LoggerContext());
        this.patternLayout.setPattern(messagePattern);
        this.patternLayout.start();
       
View Full Code Here

Examples of com.google.gson.GsonBuilder

        flat.put("caption", caption);
        flat.put("player", videos);
        flat.put("thumbnail_url", thumbnailUrl);
        flat.put("thumbnail_width", thumbnailWidth);
        flat.put("thumbnail_height", thumbnailHeight);
        Gson gson = new GsonBuilder().registerTypeAdapter(Post.class, new PostDeserializer()).create();
        post = (VideoPost) gson.fromJson(flatSerialize(flat), Post.class);
    }
View Full Code Here

Examples of com.google.gson.GsonBuilder

   *
   * @return the gson
   */
  private Gson getGson() {
    if (gson == null) {
      gson = new GsonBuilder()
          .setDateFormat(DATE_FORMAT)
          .registerTypeAdapter(
              PERMISSION_TYPE.class,
              new PermissionTypeDeserializer())
          .registerTypeAdapter(
View Full Code Here

Examples of com.google.gson.GsonBuilder

    /* package-visible for testing */ ResponseWrapper clear(Response response) {
        if (response.getCode() == 200 || response.getCode() == 201) {
            String json = response.getBody();
            try {
                Gson gson = new GsonBuilder().
                        registerTypeAdapter(JsonElement.class, new JsonElementDeserializer()).
                        create();
                ResponseWrapper wrapper = gson.fromJson(json, ResponseWrapper.class);
                if (wrapper == null) {
                    throw new JumblrException(response);
View Full Code Here

Examples of com.google.gson.GsonBuilder

        e.setClient(client);
        return e;
    }

    private Gson gsonParser() {
        return new GsonBuilder().
            registerTypeAdapter(Post.class, new PostDeserializer()).
            create();
    }
View Full Code Here

Examples of com.google.gson.GsonBuilder

        Map<String, String> flat = new HashMap<String, String>();
        flat.put("type", "link");
        flat.put("title", title);
        flat.put("description", desc);
        flat.put("url", url);
        Gson gson = new GsonBuilder().registerTypeAdapter(Post.class, new PostDeserializer()).create();
        post = (LinkPost) gson.fromJson(flatSerialize(flat), Post.class);
    }
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.