Class GSONUtils

java.lang.Object
com.ticxo.modelengine.api.utils.data.GSONUtils

public class GSONUtils extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> T
    get(com.google.gson.JsonElement element, String key, Function<com.google.gson.JsonElement,T> func)
     
    static <T> T
    get(com.google.gson.JsonElement element, String key, Function<com.google.gson.JsonElement,T> func, T def)
     
    static <T> T
    get(com.google.gson.JsonElement element, Function<com.google.gson.JsonElement,T> func, T def)
     
    static Float[]
    getAsFloatArray(com.google.gson.JsonElement jsonElement)
     
    static UUID
    getAsUUID(com.google.gson.JsonElement jsonElement)
     
    static void
    ifArray(com.google.gson.JsonElement element, String key, BiConsumer<Integer,com.google.gson.JsonElement> forEach)
     
    static void
    ifArray(com.google.gson.JsonElement element, String key, Consumer<com.google.gson.JsonElement> forEach)
     
    static void
    ifPresent(com.google.gson.JsonElement element, String key, Consumer<com.google.gson.JsonElement> consumer)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GSONUtils

      public GSONUtils()
  • Method Details

    • ifPresent

      public static void ifPresent(com.google.gson.JsonElement element, String key, Consumer<com.google.gson.JsonElement> consumer)
    • ifArray

      public static void ifArray(com.google.gson.JsonElement element, String key, Consumer<com.google.gson.JsonElement> forEach)
    • ifArray

      public static void ifArray(com.google.gson.JsonElement element, String key, BiConsumer<Integer,com.google.gson.JsonElement> forEach)
    • get

      @Nullable public static <T> T get(com.google.gson.JsonElement element, String key, Function<com.google.gson.JsonElement,T> func)
    • get

      @NotNull public static <T> T get(com.google.gson.JsonElement element, String key, Function<com.google.gson.JsonElement,T> func, @NotNull T def)
    • get

      @NotNull public static <T> T get(com.google.gson.JsonElement element, Function<com.google.gson.JsonElement,T> func, @NotNull T def)
    • getAsFloatArray

      public static Float[] getAsFloatArray(com.google.gson.JsonElement jsonElement)
    • getAsUUID

      public static UUID getAsUUID(com.google.gson.JsonElement jsonElement)