public final class JsonUtil extends Object
Modifier and Type | Field and Description |
---|---|
protected static com.google.gson.Gson |
gsonMapper |
Constructor and Description |
---|
JsonUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addArrayField(com.google.gson.JsonObject jsonObject,
String name,
String[] array) |
static void |
addDateField(com.google.gson.JsonObject jsonObject,
String name,
Date date) |
static void |
addDefaultField(com.google.gson.JsonObject jsonObject,
String name,
boolean defaultValue,
Boolean value) |
static <T> void |
addElement(com.google.gson.JsonArray jsonObject,
JsonObjectConverter<T> converter,
T value) |
static void |
addField(com.google.gson.JsonObject jsonObject,
String name,
Boolean value) |
static void |
addField(com.google.gson.JsonObject jsonObject,
String name,
Double value) |
static void |
addField(com.google.gson.JsonObject jsonObject,
String name,
Integer value) |
static void |
addField(com.google.gson.JsonObject jsonObject,
String name,
com.google.gson.JsonArray value) |
static <T> void |
addField(com.google.gson.JsonObject jsonObject,
String name,
JsonObjectConverter<T> converter,
T value) |
static void |
addField(com.google.gson.JsonObject jsonObject,
String name,
Long value) |
static void |
addField(com.google.gson.JsonObject jsonObject,
String name,
Short value) |
static void |
addField(com.google.gson.JsonObject jsonObject,
String name,
String value) |
static void |
addFieldRawValue(com.google.gson.JsonObject jsonObject,
String memberName,
Object rawValue) |
static <T> void |
addListField(com.google.gson.JsonObject jsonObject,
String name,
JsonObjectConverter<T> converter,
List<T> list) |
static void |
addListField(com.google.gson.JsonObject jsonObject,
String name,
List<String> list) |
static void |
addNullField(com.google.gson.JsonObject jsonObject,
String name) |
static com.google.gson.JsonArray |
asArray(List<String> list) |
static byte[] |
asBytes(com.google.gson.JsonElement jsonObject) |
static <T> T |
asJavaObject(com.google.gson.JsonObject jsonObject,
JsonObjectConverter<T> converter) |
static <T> List<T> |
asList(com.google.gson.JsonArray jsonArray,
JsonObjectConverter<T> converter) |
static List<Object> |
asList(com.google.gson.JsonElement jsonElement) |
static Map<String,Object> |
asMap(com.google.gson.JsonElement jsonElement) |
static com.google.gson.JsonObject |
asObject(byte[] byteArray) |
static com.google.gson.JsonObject |
asObject(Map<String,Object> properties) |
static com.google.gson.JsonObject |
asObject(String jsonString) |
static Object |
asPrimitiveObject(com.google.gson.JsonPrimitive jsonValue) |
static String |
asString(Map<String,Object> properties) |
static String |
asString(Object data) |
static List<String> |
asStringList(com.google.gson.JsonElement jsonObject) |
static com.google.gson.JsonArray |
createArray() |
static com.google.gson.Gson |
createGsonMapper() |
static com.google.gson.JsonObject |
createObject() |
static com.google.gson.JsonArray |
getArray(com.google.gson.JsonElement json) |
static com.google.gson.JsonArray |
getArray(com.google.gson.JsonObject json,
String memberName) |
static boolean |
getBoolean(com.google.gson.JsonObject json,
String memberName) |
static com.google.gson.Gson |
getGsonMapper() |
static int |
getInt(com.google.gson.JsonObject json,
String memberName) |
static long |
getLong(com.google.gson.JsonObject json,
String memberName) |
static com.google.gson.JsonObject |
getObject(com.google.gson.JsonElement json) |
static com.google.gson.JsonObject |
getObject(com.google.gson.JsonObject json,
String memberName) |
static Object |
getRawObject(com.google.gson.JsonObject jsonObject,
String memberName) |
static String |
getString(com.google.gson.JsonElement jsonElement) |
static String |
getString(com.google.gson.JsonObject json,
String memberName) |
static boolean |
isNull(com.google.gson.JsonObject jsonObject,
String memberName) |
protected static Number |
parseNumber(String numberString) |
public static void addFieldRawValue(com.google.gson.JsonObject jsonObject, String memberName, Object rawValue)
public static <T> void addField(com.google.gson.JsonObject jsonObject, String name, JsonObjectConverter<T> converter, T value)
public static void addListField(com.google.gson.JsonObject jsonObject, String name, List<String> list)
public static void addArrayField(com.google.gson.JsonObject jsonObject, String name, String[] array)
public static void addDateField(com.google.gson.JsonObject jsonObject, String name, Date date)
public static <T> void addElement(com.google.gson.JsonArray jsonObject, JsonObjectConverter<T> converter, T value)
public static <T> void addListField(com.google.gson.JsonObject jsonObject, String name, JsonObjectConverter<T> converter, List<T> list)
public static <T> T asJavaObject(com.google.gson.JsonObject jsonObject, JsonObjectConverter<T> converter)
public static void addNullField(com.google.gson.JsonObject jsonObject, String name)
public static void addField(com.google.gson.JsonObject jsonObject, String name, com.google.gson.JsonArray value)
public static void addField(com.google.gson.JsonObject jsonObject, String name, String value)
public static void addField(com.google.gson.JsonObject jsonObject, String name, Boolean value)
public static void addField(com.google.gson.JsonObject jsonObject, String name, Integer value)
public static void addField(com.google.gson.JsonObject jsonObject, String name, Short value)
public static void addField(com.google.gson.JsonObject jsonObject, String name, Long value)
public static void addField(com.google.gson.JsonObject jsonObject, String name, Double value)
public static void addDefaultField(com.google.gson.JsonObject jsonObject, String name, boolean defaultValue, Boolean value)
public static byte[] asBytes(com.google.gson.JsonElement jsonObject)
public static com.google.gson.JsonObject asObject(byte[] byteArray)
public static com.google.gson.JsonObject asObject(String jsonString)
public static <T> List<T> asList(com.google.gson.JsonArray jsonArray, JsonObjectConverter<T> converter)
public static Object getRawObject(com.google.gson.JsonObject jsonObject, String memberName)
public static Object asPrimitiveObject(com.google.gson.JsonPrimitive jsonValue)
public static boolean getBoolean(com.google.gson.JsonObject json, String memberName)
public static String getString(com.google.gson.JsonElement jsonElement)
public static int getInt(com.google.gson.JsonObject json, String memberName)
public static boolean isNull(com.google.gson.JsonObject jsonObject, String memberName)
public static long getLong(com.google.gson.JsonObject json, String memberName)
public static com.google.gson.JsonArray getArray(com.google.gson.JsonObject json, String memberName)
public static com.google.gson.JsonArray getArray(com.google.gson.JsonElement json)
public static com.google.gson.JsonObject getObject(com.google.gson.JsonObject json, String memberName)
public static com.google.gson.JsonObject getObject(com.google.gson.JsonElement json)
public static com.google.gson.JsonObject createObject()
public static com.google.gson.JsonArray createArray()
public static com.google.gson.Gson getGsonMapper()
public static com.google.gson.Gson createGsonMapper()
Copyright © 2021. All rights reserved.