类 GsonUtils


  • public class GsonUtils
    extends Object
    • 构造器详细资料

      • GsonUtils

        public GsonUtils()
    • 方法详细资料

      • 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​(String json,
                                     Class<T> cls)
      • 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)
      • toJsonString

        public static String toJsonString​(Object object)
        任何对象转string
        参数:
        object -
        返回:
      • toJsonBytes

        public static byte[] toJsonBytes​(Object object)
      • toList

        public static <T> List<T> toList​(String json,
                                         Class<T> clazz)
        类型参数:
        T - T类型
        参数:
        json - list的序列化字符串
        返回:
        List
      • toRObject

        public static <T> R<T> toRObject​(String json,
                                         Class<T> clazz)
      • toRList

        public static <T> RList<T> toRList​(String json,
                                           Class<T> clazz)