类 GsonUtils
- java.lang.Object
-
- com.baidu.brcc.utils.gson.GsonUtils
-
public class GsonUtils extends Object
-
-
构造器概要
构造器 构造器 说明 GsonUtils()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static BytegetByteOrDefault(com.google.gson.JsonElement object, Byte defaultValue, String... path)static DoublegetDoubleOrDefault(com.google.gson.JsonElement object, Double defaultValue, String... path)static IntegergetIntegerOrDefault(com.google.gson.JsonElement object, Integer defaultValue, String... path)static com.google.gson.JsonArraygetJsonArray(com.google.gson.JsonObject object, String... path)static com.google.gson.JsonElementgetJsonElement(com.google.gson.JsonObject object, String... path)static com.google.gson.JsonElementgetJsonObject(com.google.gson.JsonElement object, String... path)static LonggetLongOrDefault(com.google.gson.JsonElement object, Long defaultValue, String... path)static StringgetStringOrDefault(com.google.gson.JsonElement object, String defaultValue, String... path)static voidremoveJsonPropertiesProperties(com.google.gson.JsonObject jsonObject, String... property)static com.google.gson.JsonArraytoJsonArray(String json)static byte[]toJsonBytes(Object object)static com.google.gson.JsonElementtoJsonElement(String json)static com.google.gson.JsonObjecttoJsonObject(String json)static StringtoJsonString(Object object)任何对象转stringstatic <T> List<T>toList(String json, Class<T> clazz)static <T> TtoObject(byte[] json, Class<T> cls)static <T> TtoObject(com.google.gson.JsonElement json, Class<T> cls)static <T> TtoObject(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)
-
-
-
方法详细资料
-
getJsonObject
public static com.google.gson.JsonElement getJsonObject(com.google.gson.JsonElement object, String... path)
-
getJsonArray
public static com.google.gson.JsonArray getJsonArray(com.google.gson.JsonObject object, String... path)
-
toJsonObject
public static com.google.gson.JsonObject toJsonObject(String json)
-
toJsonArray
public static com.google.gson.JsonArray toJsonArray(String json)
-
toObject
public static <T> T toObject(byte[] json, Class<T> cls)
-
toJsonElement
public static com.google.gson.JsonElement toJsonElement(String json)
-
toObject
public static <T> T toObject(com.google.gson.JsonElement json, Class<T> cls)
-
getStringOrDefault
public static String getStringOrDefault(com.google.gson.JsonElement object, String defaultValue, String... path)
-
getByteOrDefault
public static Byte getByteOrDefault(com.google.gson.JsonElement object, Byte defaultValue, String... path)
-
getIntegerOrDefault
public static Integer getIntegerOrDefault(com.google.gson.JsonElement object, Integer defaultValue, String... path)
-
getLongOrDefault
public static Long getLongOrDefault(com.google.gson.JsonElement object, Long defaultValue, String... path)
-
getDoubleOrDefault
public static Double getDoubleOrDefault(com.google.gson.JsonElement object, Double defaultValue, String... path)
-
getJsonElement
public static com.google.gson.JsonElement getJsonElement(com.google.gson.JsonObject object, String... path)
-
removeJsonPropertiesProperties
public static void removeJsonPropertiesProperties(com.google.gson.JsonObject jsonObject, String... property)
-
toJsonBytes
public static byte[] toJsonBytes(Object object)
-
toList
public static <T> List<T> toList(String json, Class<T> clazz)
- 类型参数:
T- T类型- 参数:
json- list的序列化字符串- 返回:
- List
-
-