Class GsonUtil

java.lang.Object
io.github.emcw.utils.GsonUtil

public class GsonUtil extends Object
  • Constructor Details

    • GsonUtil

      public GsonUtil()
  • Method Details

    • serialize

      public static String serialize(Object obj)
    • getType

      public static <T> Type getType(@NotNull T obj)
    • getType

      public static <T> Type getType(Class<T> clazz)
    • deserialize

      public static <T> T deserialize(String str, Class<T> c)
    • deserialize

      public static <T> T deserialize(String str, Type type)
    • deserialize

      public static <T> T deserialize(com.google.gson.JsonElement el, Type type)
    • convert

      public static <T> T convert(Object obj, Class<T> clazz)
    • asTree

      public static <T extends com.google.gson.JsonElement> T asTree(Object input)
    • toList

      public static <T> List<T> toList(Object obj)
    • mapToArr

      @NotNull public static <T> @NotNull com.google.gson.JsonArray mapToArr(@NotNull @NotNull Map<String,T> map)
    • arrToMap

      @NotNull public static <T> @NotNull Map<String,T> arrToMap(@NotNull @NotNull com.google.gson.JsonArray arr, String key)
    • arrToIntArr

      public static int[] arrToIntArr(@NotNull @NotNull com.google.gson.JsonArray arr)
    • arrFromStrArr

      @NotNull public static @NotNull com.google.gson.JsonArray arrFromStrArr(String[] obj)
    • strArrAsStream

      public static Stream<String> strArrAsStream(@NotNull @NotNull String[] arr)
    • arrAsStream

      public static Stream<com.google.gson.JsonElement> arrAsStream(@NotNull @NotNull com.google.gson.JsonArray arr)
    • streamEntries

      public static Stream<Map.Entry<String,com.google.gson.JsonElement>> streamEntries(@NotNull @NotNull com.google.gson.JsonObject o)
    • streamEntries

      public static <T> Stream<Map.Entry<String,T>> streamEntries(@NotNull @NotNull Map<String,T> o)
    • streamValues

      public static <T> Stream<T> streamValues(@NotNull @NotNull Map<String,T> o)
    • intersection

      public static Map<String,com.google.gson.JsonObject> intersection(com.google.gson.JsonArray arr, com.google.gson.JsonArray arr2)
    • difference

      public static Map<String,Player> difference(com.google.gson.JsonArray ops, com.google.gson.JsonArray residents)
    • difference

      public static Map<String,Player> difference(com.google.gson.JsonArray ops, com.google.gson.JsonArray residents, String key)
    • valueAsObj

      public static <T> com.google.gson.JsonObject valueAsObj(Map.Entry<String,T> entry)
    • keyAsObj

      @Nullable public static @Nullable com.google.gson.JsonObject keyAsObj(com.google.gson.JsonObject o, String k)
    • keyAsBool

      @NotNull public static @NotNull Boolean keyAsBool(com.google.gson.JsonObject o, String k)
    • keyAsInt

      @Nullable public static @Nullable Integer keyAsInt(com.google.gson.JsonObject o, String k)
    • keyAsStr

      @Nullable public static @Nullable String keyAsStr(com.google.gson.JsonObject o, String k)
    • keyAsArr

      public static com.google.gson.JsonArray keyAsArr(com.google.gson.JsonObject obj, String key)
    • mapToObj

      @NotNull public static @NotNull com.google.gson.JsonObject mapToObj(@NotNull @NotNull Map<String,com.google.gson.JsonObject> map)