Class GsonUtil
java.lang.Object
io.github.emcw.utils.GsonUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.google.gson.JsonArrayarrAsJsonArray(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 ofJsonElements.static <T> Tstatic <T> Tdeserialize(com.google.gson.JsonElement el, Type type) static <T> Tdeserialize(String str, Class<T> c) static <T> Tdeserialize(String str, Type type) static com.google.gson.JsonArrayflattenJsonArr(com.google.gson.JsonArray arr, int depth) static <T> Typestatic <T> TypegetType(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.JsonArraystatic @Nullable Booleanstatic @Nullable DoublekeyAsDouble(com.google.gson.JsonObject o, String k) static @Nullable Integerstatic @Nullable com.google.gson.JsonObjectstatic @Nullable Stringstatic <T> @NotNull com.google.gson.JsonArraystatic @NotNull com.google.gson.JsonObjectstatic StringstreamEntries(@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 ofJsonElements. -
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)
-