public class GsonUtils extends Object
| 构造器和说明 |
|---|
GsonUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static Byte |
getByteOrDefault(com.google.gson.JsonElement object,
Byte defaultValue,
String... path) |
static Double |
getDoubleOrDefault(com.google.gson.JsonElement object,
Double defaultValue,
String... path) |
static Integer |
getIntegerOrDefault(com.google.gson.JsonElement object,
Integer defaultValue,
String... path) |
static com.google.gson.JsonArray |
getJsonArray(com.google.gson.JsonObject object,
String... path) |
static com.google.gson.JsonElement |
getJsonElement(com.google.gson.JsonObject object,
String... path) |
static com.google.gson.JsonElement |
getJsonObject(com.google.gson.JsonElement object,
String... path) |
static Long |
getLongOrDefault(com.google.gson.JsonElement object,
Long defaultValue,
String... path) |
static String |
getStringOrDefault(com.google.gson.JsonElement object,
String defaultValue,
String... path) |
static void |
removeJsonPropertiesProperties(com.google.gson.JsonObject jsonObject,
String... property) |
static com.google.gson.JsonArray |
toJsonArray(String json) |
static byte[] |
toJsonBytes(Object object) |
static com.google.gson.JsonElement |
toJsonElement(String json) |
static com.google.gson.JsonObject |
toJsonObject(String json) |
static String |
toJsonString(Object object)
任何对象转string
|
static <T> List<T> |
toList(String json,
Class<T> clazz) |
static <T> T |
toObject(byte[] json,
Class<T> cls) |
static <T> T |
toObject(com.google.gson.JsonElement json,
Class<T> cls) |
static <T> T |
toObject(String json,
Class<T> cls) |
static <T> RList<T> |
toRList(String json,
Class<T> clazz) |
static <T> R<T> |
toRObject(String json,
Class<T> clazz) |
public static com.google.gson.JsonElement getJsonObject(com.google.gson.JsonElement object,
String... path)
public static com.google.gson.JsonArray getJsonArray(com.google.gson.JsonObject object,
String... path)
public static com.google.gson.JsonObject toJsonObject(String json)
public static com.google.gson.JsonArray toJsonArray(String json)
public static <T> T toObject(byte[] json,
Class<T> cls)
public static com.google.gson.JsonElement toJsonElement(String json)
public static <T> T toObject(com.google.gson.JsonElement json,
Class<T> cls)
public static String getStringOrDefault(com.google.gson.JsonElement object, String defaultValue, String... path)
public static Byte getByteOrDefault(com.google.gson.JsonElement object, Byte defaultValue, String... path)
public static Integer getIntegerOrDefault(com.google.gson.JsonElement object, Integer defaultValue, String... path)
public static Long getLongOrDefault(com.google.gson.JsonElement object, Long defaultValue, String... path)
public static Double getDoubleOrDefault(com.google.gson.JsonElement object, Double defaultValue, String... path)
public static com.google.gson.JsonElement getJsonElement(com.google.gson.JsonObject object,
String... path)
public static void removeJsonPropertiesProperties(com.google.gson.JsonObject jsonObject,
String... property)
public static byte[] toJsonBytes(Object object)
public static <T> List<T> toList(String json, Class<T> clazz)
T - T类型json - list的序列化字符串Copyright © 2021. All rights reserved.