Search in sources :

Example 91 with JsonPrimitive

use of com.google.gson.JsonPrimitive in project blogwt by billy1380.

the class CreatePostRequest method toJson.

@Override
public JsonObject toJson() {
    JsonObject object = super.toJson();
    JsonElement jsonPost = post == null ? JsonNull.INSTANCE : post.toJson();
    object.add("post", jsonPost);
    JsonElement jsonPublish = publish == null ? JsonNull.INSTANCE : new JsonPrimitive(publish);
    object.add("publish", jsonPublish);
    return object;
}
Also used : JsonPrimitive(com.google.gson.JsonPrimitive) JsonElement(com.google.gson.JsonElement) JsonObject(com.google.gson.JsonObject)

Example 92 with JsonPrimitive

use of com.google.gson.JsonPrimitive in project blogwt by billy1380.

the class GetArchiveEntriesRequest method toJson.

@Override
public JsonObject toJson() {
    JsonObject object = super.toJson();
    JsonElement jsonIncludePosts = includePosts == null ? JsonNull.INSTANCE : new JsonPrimitive(includePosts);
    object.add("includePosts", jsonIncludePosts);
    return object;
}
Also used : JsonPrimitive(com.google.gson.JsonPrimitive) JsonElement(com.google.gson.JsonElement) JsonObject(com.google.gson.JsonObject)

Example 93 with JsonPrimitive

use of com.google.gson.JsonPrimitive in project blogwt by billy1380.

the class GetPostsRequest method toJson.

@Override
public JsonObject toJson() {
    JsonObject object = super.toJson();
    JsonElement jsonPager = pager == null ? JsonNull.INSTANCE : pager.toJson();
    object.add("pager", jsonPager);
    JsonElement jsonIncludePostContents = includePostContents == null ? JsonNull.INSTANCE : new JsonPrimitive(includePostContents);
    object.add("includePostContents", jsonIncludePostContents);
    JsonElement jsonTag = tag == null ? JsonNull.INSTANCE : new JsonPrimitive(tag);
    object.add("tag", jsonTag);
    JsonElement jsonArchiveEntry = archiveEntry == null ? JsonNull.INSTANCE : archiveEntry.toJson();
    object.add("archiveEntry", jsonArchiveEntry);
    JsonElement jsonQuery = query == null ? JsonNull.INSTANCE : new JsonPrimitive(query);
    object.add("query", jsonQuery);
    JsonElement jsonShowAll = showAll == null ? JsonNull.INSTANCE : new JsonPrimitive(showAll);
    object.add("showAll", jsonShowAll);
    return object;
}
Also used : JsonPrimitive(com.google.gson.JsonPrimitive) JsonElement(com.google.gson.JsonElement) JsonObject(com.google.gson.JsonObject)

Example 94 with JsonPrimitive

use of com.google.gson.JsonPrimitive in project blogwt by billy1380.

the class GetTagsRequest method toJson.

@Override
public JsonObject toJson() {
    JsonObject object = super.toJson();
    JsonElement jsonIncludePosts = includePosts == null ? JsonNull.INSTANCE : new JsonPrimitive(includePosts);
    object.add("includePosts", jsonIncludePosts);
    return object;
}
Also used : JsonPrimitive(com.google.gson.JsonPrimitive) JsonElement(com.google.gson.JsonElement) JsonObject(com.google.gson.JsonObject)

Example 95 with JsonPrimitive

use of com.google.gson.JsonPrimitive in project blogwt by billy1380.

the class DataType method toJson.

@Override
public JsonObject toJson() {
    JsonObject object = super.toJson();
    JsonElement jsonId = id == null ? JsonNull.INSTANCE : new JsonPrimitive(id);
    object.add("id", jsonId);
    JsonElement jsonCreated = created == null ? JsonNull.INSTANCE : new JsonPrimitive(created.getTime());
    object.add("created", jsonCreated);
    return object;
}
Also used : JsonPrimitive(com.google.gson.JsonPrimitive) JsonElement(com.google.gson.JsonElement) JsonObject(com.google.gson.JsonObject)

Aggregations

JsonPrimitive (com.google.gson.JsonPrimitive)230 JsonObject (com.google.gson.JsonObject)137 JsonArray (com.google.gson.JsonArray)118 JsonElement (com.google.gson.JsonElement)106 Test (org.testng.annotations.Test)56 Test (org.junit.Test)12 Map (java.util.Map)10 Matchers.anyString (org.mockito.Matchers.anyString)8 JsonProcessorInjectionMap (com.builtbroken.mc.lib.json.loading.JsonProcessorInjectionMap)7 Gson (com.google.gson.Gson)6 HashMap (java.util.HashMap)5 GsonBuilder (com.google.gson.GsonBuilder)4 JsonParser (com.google.gson.JsonParser)4 ArrayList (java.util.ArrayList)4 Date (java.util.Date)4 Type (java.lang.reflect.Type)3 HashSet (java.util.HashSet)3 Matcher (java.util.regex.Matcher)3 LobWrapper (angularBeans.io.LobWrapper)2 DatasetCreationSpec (co.cask.cdap.internal.dataset.DatasetCreationSpec)2