public class JsonObjectUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> String |
getAsJsonString(T source,
int depth) |
static Boolean |
getBoolean(com.google.gson.JsonObject obj,
String prop) |
static Boolean |
getBoolean(com.google.gson.JsonObject obj,
String prop,
Boolean defaultValue) |
static Integer |
getInteger(com.google.gson.JsonObject obj,
String prop) |
static Integer |
getInteger(com.google.gson.JsonObject obj,
String prop,
Integer defaultValue) |
static Long |
getLong(com.google.gson.JsonObject obj,
String prop) |
static Long |
getLong(com.google.gson.JsonObject obj,
String prop,
Long defaultValue) |
static Optional<com.google.gson.JsonElement> |
getOptional(com.google.gson.JsonObject obj,
String prop) |
static Optional<com.google.gson.JsonObject> |
getOptionalObject(com.google.gson.JsonObject obj,
String prop) |
static <T> T |
getOptionalProperty(com.google.gson.JsonObject obj,
String prop,
Function<com.google.gson.JsonElement,T> getter,
T defaultValue) |
static String |
getString(com.google.gson.JsonObject obj,
String prop) |
static String |
getString(com.google.gson.JsonObject obj,
String prop,
String defaultValue) |
static boolean |
isSingularElement(com.google.gson.JsonElement elem) |
static void |
pruneToDepth(com.google.gson.JsonObject obj,
int depth) |
static com.google.gson.JsonObject |
toJsonObject(Object source) |
static com.google.gson.JsonObject |
toJsonObject(org.apache.sling.api.resource.Resource resource) |
static com.google.gson.JsonObject |
toJsonObject(String json) |
static <T> com.google.gson.JsonObject |
toJsonObject(T source,
int depth) |
public static com.google.gson.JsonObject toJsonObject(String json)
public static com.google.gson.JsonObject toJsonObject(org.apache.sling.api.resource.Resource resource)
public static com.google.gson.JsonObject toJsonObject(Object source)
public static <T> com.google.gson.JsonObject toJsonObject(T source,
int depth)
public static void pruneToDepth(com.google.gson.JsonObject obj,
int depth)
public static <T> String getAsJsonString(T source, int depth)
public static boolean isSingularElement(com.google.gson.JsonElement elem)
public static Optional<com.google.gson.JsonElement> getOptional(com.google.gson.JsonObject obj, String prop)
public static <T> T getOptionalProperty(com.google.gson.JsonObject obj,
String prop,
Function<com.google.gson.JsonElement,T> getter,
T defaultValue)
public static Optional<com.google.gson.JsonObject> getOptionalObject(com.google.gson.JsonObject obj, String prop)
public static String getString(com.google.gson.JsonObject obj, String prop, String defaultValue)
public static Integer getInteger(com.google.gson.JsonObject obj, String prop, Integer defaultValue)
public static Boolean getBoolean(com.google.gson.JsonObject obj, String prop, Boolean defaultValue)
Copyright © 2013–2020 Adobe. All rights reserved.