Class GsonUtil
java.lang.Object
io.github.emcw.utils.GsonUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.google.gson.JsonArray
arrAsJsonArray
(Object[] objects) static Stream
<com.google.gson.JsonElement> arrAsStream
(@NotNull com.google.gson.JsonArray arr) static int[]
arrToIntArr
(@NotNull com.google.gson.JsonArray arr) static <T extends com.google.gson.JsonElement>
TSerializes the specified object into its equivalent representation as a tree ofJsonElement
s.static <T> T
static <T> T
deserialize
(com.google.gson.JsonElement el, Type type) static <T> T
deserialize
(String str, Class<T> c) static <T> T
deserialize
(String str, Type type) static com.google.gson.JsonArray
flattenJsonArr
(com.google.gson.JsonArray arr, int depth) static <T> Type
static <T> Type
getType
(T obj) intersection
(com.google.gson.JsonArray arr, com.google.gson.JsonArray arr2) jsonArrToMap
(@NotNull com.google.gson.JsonArray arr, String key) static com.google.gson.JsonArray
static @Nullable Boolean
static @Nullable Double
keyAsDouble
(com.google.gson.JsonObject o, String k) static @Nullable Integer
static @Nullable com.google.gson.JsonObject
static @Nullable String
static <T> @NotNull com.google.gson.JsonArray
static @NotNull com.google.gson.JsonObject
static String
streamEntries
(@NotNull com.google.gson.JsonObject o) streamEntries
(@NotNull Map<String, T> o) static <T> Stream
<T> streamValues
(@NotNull Map<String, T> o) static <T> List
<T> toList
(com.google.gson.JsonElement el) Serializes the inputel
, and deserializes it back as a list ofGsonUtil
.
-
Constructor Details
-
GsonUtil
public GsonUtil()
-
-
Method Details
-
getType
-
getType
-
serialize
-
deserialize
-
deserialize
-
deserialize
-
convert
-
asTree
Serializes the specified object into its equivalent representation as a tree ofJsonElement
s. -
toList
-
mapToArr
-
jsonArrToMap
-
arrToIntArr
public static int[] arrToIntArr(@NotNull @NotNull com.google.gson.JsonArray arr) -
arrAsStream
public static Stream<com.google.gson.JsonElement> arrAsStream(@NotNull @NotNull com.google.gson.JsonArray arr) -
streamEntries
-
streamEntries
-
streamValues
-
intersection
-
keyAsObj
@Nullable public static @Nullable com.google.gson.JsonObject keyAsObj(com.google.gson.JsonObject o, String k) -
keyAsBool
-
keyAsInt
-
keyAsStr
-
keyAsDouble
-
keyAsArr
-
mapToObj
-
arrAsJsonArray
-
flattenJsonArr
public static com.google.gson.JsonArray flattenJsonArr(com.google.gson.JsonArray arr, int depth)
-