public final class GsonUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.util.Optional<com.google.gson.JsonElement> |
getJsonElement(com.google.gson.JsonObject root,
java.lang.String path)
Gets an element from the provided path for the provided object.
|
static boolean |
isJsonArray(java.util.Optional<com.google.gson.JsonElement> optional)
Checks if a json element is a json array.
|
static boolean |
isJsonObject(java.util.Optional<com.google.gson.JsonElement> optional)
Checks if a json element is a json object.
|
static boolean |
isJsonPrimitive(java.util.Optional<com.google.gson.JsonElement> optional)
Checks if a json element is a json primitive.
|
static boolean |
pathExists(com.google.gson.JsonObject root,
java.lang.String path)
Determines if a json element exists in the provided path for the provided object.
|
public static boolean pathExists(com.google.gson.JsonObject root, java.lang.String path)
root
- the object to search inpath
- the path to fetchpublic static java.util.Optional<com.google.gson.JsonElement> getJsonElement(com.google.gson.JsonObject root, java.lang.String path)
root
- the object to search inpath
- the path to fetchpublic static boolean isJsonObject(java.util.Optional<com.google.gson.JsonElement> optional)
optional
- the elementpublic static boolean isJsonArray(java.util.Optional<com.google.gson.JsonElement> optional)
optional
- the elementpublic static boolean isJsonPrimitive(java.util.Optional<com.google.gson.JsonElement> optional)
optional
- the element