Examples of GsonBuilder


Examples of com.google.gson.GsonBuilder

        flat.put("artist", artistName);
        flat.put("album_art", albumArtUrl);
        flat.put("year", year);
        flat.put("track_number", trackNumber);
        flat.put("player", embedCode);
        Gson gson = new GsonBuilder().registerTypeAdapter(Post.class, new PostDeserializer()).create();
        post = (AudioPost) gson.fromJson(flatSerialize(flat), Post.class);
    }
View Full Code Here

Examples of com.google.gson.GsonBuilder

        flat.put("title", title);
        flat.put("body", body);
        flat.put("note_count", noteCount);
        flat.put("reblogged_from_id", rebloggedFromId);
        flat.put("reblogged_from_name", rebloggedFromName);
        Gson gson = new GsonBuilder().registerTypeAdapter(Post.class, new PostDeserializer()).create();
        post = (TextPost) gson.fromJson(flatSerialize(flat), Post.class);
    }
View Full Code Here

Examples of com.google.gson.GsonBuilder

        flat.put("type", "answer");
        flat.put("asking_url", askingUrl);
        flat.put("asking_name", askingName);
        flat.put("question", question);
        flat.put("answer", answer);
        Gson gson = new GsonBuilder().registerTypeAdapter(Post.class, new PostDeserializer()).create();
        post = (AnswerPost) gson.fromJson(flatSerialize(flat), Post.class);
    }
View Full Code Here

Examples of com.google.gson.GsonBuilder

        Map<String, String> flat = new HashMap<String, String>();
        flat.put("type", "chat");
        flat.put("title", title);
        flat.put("body", body);
        flat.put("dialogue", dialogue);
        Gson gson = new GsonBuilder().registerTypeAdapter(Post.class, new PostDeserializer()).create();
        post = (ChatPost) gson.fromJson(flatSerialize(flat), Post.class);
    }
View Full Code Here

Examples of com.google.gson.GsonBuilder

    @Before
    public void setup() {
        Map<String, Object> flat = new HashMap<String, Object>();
        flat.put("type", "nonexistent");
        flat.put("id", id);
        Gson gson = new GsonBuilder().registerTypeAdapter(Post.class, new PostDeserializer()).create();
        post = gson.fromJson(flatSerialize(flat), Post.class);
    }
View Full Code Here

Examples of com.google.gson.GsonBuilder

        flat.put("text", text);
        flat.put("author", author);
        flat.put("slug", slug);
        flat.put("notes", notes);
        flat.put("note_count", 123);
        Gson gson = new GsonBuilder().registerTypeAdapter(Post.class, new PostDeserializer()).create();
        post = (QuotePost) gson.fromJson(flatSerialize(flat), Post.class);
    }
View Full Code Here

Examples of com.google.gson.GsonBuilder

        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.GsonBuilder

  }


  public IString toJSON(IValue value) {
    IValueAdapter adap = new IValueAdapter();
    Gson gson = new GsonBuilder()
    .registerTypeAdapter(IValue.class, adap)
    .enableComplexMapKeySerialization()
    .setDateFormat(DateFormat.LONG)
    .setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE)
    .setVersion(1.0)
View Full Code Here

Examples of com.google.gson.GsonBuilder

    }
  }
  public IValue fromJSON(IValue type, IString src, IEvaluatorContext ctx) {
    TypeStore store = ctx.getCurrentEnvt().getStore();
    Type start = new TypeReifier(ctx.getValueFactory()).valueToType((IConstructor) type, store);
    Gson gson = new GsonBuilder()
    .enableComplexMapKeySerialization()
    .setDateFormat(DateFormat.LONG)
    .setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE)
    .setVersion(1.0)
    .create();
View Full Code Here

Examples of com.google.gson.GsonBuilder

   
    //TypeStore store = ctx.getCurrentEnvt().getStore();
    //Type start = new TypeReifier(ctx.getValueFactory()).valueToType((IConstructor) type, store);
   
    System.err.println("fromJSON0:"+start);
    Gson gson = new GsonBuilder()
    .enableComplexMapKeySerialization()
    .setDateFormat(DateFormat.LONG)
    .setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE)
    .setVersion(1.0)
    .create();
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.