public class JsonHelper extends Object
| Modifier and Type | Field and Description |
|---|---|
private static com.google.gson.Gson |
GSON |
| Constructor and Description |
|---|
JsonHelper() |
| Modifier and Type | Method and Description |
|---|---|
static com.google.gson.JsonArray |
asArray(com.google.gson.JsonElement element,
String name) |
static boolean |
asBoolean(com.google.gson.JsonElement element,
String name) |
static byte |
asByte(com.google.gson.JsonElement element,
String name) |
static float |
asFloat(com.google.gson.JsonElement element,
String name) |
static int |
asInt(com.google.gson.JsonElement element,
String name) |
static Item |
asItem(com.google.gson.JsonElement element,
String name) |
static long |
asLong(com.google.gson.JsonElement element,
String name) |
static com.google.gson.JsonObject |
asObject(com.google.gson.JsonElement element,
String name) |
static String |
asString(com.google.gson.JsonElement element,
String name) |
static <T> T |
deserialize(com.google.gson.Gson gson,
Reader reader,
Class<T> class2) |
static <T> T |
deserialize(com.google.gson.Gson gson,
Reader reader,
Class<T> type,
boolean lenient) |
static <T> T |
deserialize(com.google.gson.Gson gson,
Reader reader,
com.google.gson.reflect.TypeToken<T> typeToken) |
static <T> T |
deserialize(com.google.gson.Gson gson,
Reader reader,
com.google.gson.reflect.TypeToken<T> typeToken,
boolean lenient) |
static <T> T |
deserialize(com.google.gson.Gson gson,
String content,
Class<T> class2) |
static <T> T |
deserialize(com.google.gson.Gson gson,
String content,
Class<T> class2,
boolean lenient) |
static <T> T |
deserialize(com.google.gson.Gson gson,
String content,
com.google.gson.reflect.TypeToken<T> typeToken) |
static <T> T |
deserialize(com.google.gson.Gson gson,
String content,
com.google.gson.reflect.TypeToken<T> typeToken,
boolean lenient) |
static <T> T |
deserialize(com.google.gson.JsonElement element,
String name,
com.google.gson.JsonDeserializationContext context,
Class<? extends T> type) |
static <T> T |
deserialize(com.google.gson.JsonObject object,
String element,
com.google.gson.JsonDeserializationContext context,
Class<? extends T> type) |
static <T> T |
deserialize(com.google.gson.JsonObject object,
String element,
T defaultValue,
com.google.gson.JsonDeserializationContext context,
Class<? extends T> type) |
static com.google.gson.JsonObject |
deserialize(Reader reader) |
static com.google.gson.JsonObject |
deserialize(Reader reader,
boolean lenient) |
static com.google.gson.JsonObject |
deserialize(String content) |
static com.google.gson.JsonObject |
deserialize(String content,
boolean lenient) |
static com.google.gson.JsonArray |
getArray(com.google.gson.JsonObject object,
String element) |
static com.google.gson.JsonArray |
getArray(com.google.gson.JsonObject object,
String name,
com.google.gson.JsonArray defaultArray) |
static boolean |
getBoolean(com.google.gson.JsonObject object,
String element) |
static boolean |
getBoolean(com.google.gson.JsonObject object,
String element,
boolean defaultBoolean) |
static byte |
getByte(com.google.gson.JsonObject object,
String element,
byte defaultByte) |
static float |
getFloat(com.google.gson.JsonObject object,
String element) |
static float |
getFloat(com.google.gson.JsonObject object,
String element,
float defaultFloat) |
static int |
getInt(com.google.gson.JsonObject object,
String element) |
static int |
getInt(com.google.gson.JsonObject object,
String element,
int defaultInt) |
static Item |
getItem(com.google.gson.JsonObject object,
String key) |
static long |
getLong(com.google.gson.JsonObject object,
String name) |
static long |
getLong(com.google.gson.JsonObject object,
String element,
long defaultLong) |
static com.google.gson.JsonObject |
getObject(com.google.gson.JsonObject object,
String element) |
static com.google.gson.JsonObject |
getObject(com.google.gson.JsonObject object,
String element,
com.google.gson.JsonObject defaultObject) |
static String |
getString(com.google.gson.JsonObject object,
String element) |
static String |
getString(com.google.gson.JsonObject object,
String element,
String defaultStr) |
static String |
getType(com.google.gson.JsonElement element) |
static boolean |
hasArray(com.google.gson.JsonObject object,
String element) |
static boolean |
hasBoolean(com.google.gson.JsonObject object,
String element) |
static boolean |
hasElement(com.google.gson.JsonObject object,
String lement) |
static boolean |
hasPrimitive(com.google.gson.JsonObject object,
String element) |
static boolean |
hasString(com.google.gson.JsonObject object,
String element) |
static boolean |
isNumber(com.google.gson.JsonElement element) |
static boolean |
isString(com.google.gson.JsonElement element) |
public static boolean hasString(com.google.gson.JsonObject object,
String element)
@Environment(value=CLIENT) public static boolean isString(com.google.gson.JsonElement element)
public static boolean isNumber(com.google.gson.JsonElement element)
@Environment(value=CLIENT)
public static boolean hasBoolean(com.google.gson.JsonObject object,
String element)
public static boolean hasArray(com.google.gson.JsonObject object,
String element)
public static boolean hasPrimitive(com.google.gson.JsonObject object,
String element)
public static boolean hasElement(com.google.gson.JsonObject object,
String lement)
public static String getString(com.google.gson.JsonObject object, String element, String defaultStr)
public static boolean asBoolean(com.google.gson.JsonElement element,
String name)
public static boolean getBoolean(com.google.gson.JsonObject object,
String element)
public static boolean getBoolean(com.google.gson.JsonObject object,
String element,
boolean defaultBoolean)
public static float asFloat(com.google.gson.JsonElement element,
String name)
public static float getFloat(com.google.gson.JsonObject object,
String element)
public static float getFloat(com.google.gson.JsonObject object,
String element,
float defaultFloat)
public static long asLong(com.google.gson.JsonElement element,
String name)
public static long getLong(com.google.gson.JsonObject object,
String name)
public static long getLong(com.google.gson.JsonObject object,
String element,
long defaultLong)
public static int asInt(com.google.gson.JsonElement element,
String name)
public static int getInt(com.google.gson.JsonObject object,
String element)
public static int getInt(com.google.gson.JsonObject object,
String element,
int defaultInt)
public static byte asByte(com.google.gson.JsonElement element,
String name)
public static byte getByte(com.google.gson.JsonObject object,
String element,
byte defaultByte)
public static com.google.gson.JsonObject asObject(com.google.gson.JsonElement element,
String name)
public static com.google.gson.JsonObject getObject(com.google.gson.JsonObject object,
String element)
public static com.google.gson.JsonObject getObject(com.google.gson.JsonObject object,
String element,
com.google.gson.JsonObject defaultObject)
public static com.google.gson.JsonArray asArray(com.google.gson.JsonElement element,
String name)
public static com.google.gson.JsonArray getArray(com.google.gson.JsonObject object,
String element)
@Nullable public static com.google.gson.JsonArray getArray(com.google.gson.JsonObject object, String name, @Nullable com.google.gson.JsonArray defaultArray)
public static <T> T deserialize(@Nullable com.google.gson.JsonElement element, String name, com.google.gson.JsonDeserializationContext context, Class<? extends T> type)
public static <T> T deserialize(com.google.gson.JsonObject object,
String element,
com.google.gson.JsonDeserializationContext context,
Class<? extends T> type)
public static <T> T deserialize(com.google.gson.JsonObject object,
String element,
T defaultValue,
com.google.gson.JsonDeserializationContext context,
Class<? extends T> type)
public static String getType(com.google.gson.JsonElement element)
@Nullable public static <T> T deserialize(com.google.gson.Gson gson, Reader reader, Class<T> type, boolean lenient)
@Environment(value=CLIENT) @Nullable public static <T> T deserialize(com.google.gson.Gson gson, Reader reader, com.google.gson.reflect.TypeToken<T> typeToken, boolean lenient)
@Environment(value=CLIENT) @Nullable public static <T> T deserialize(com.google.gson.Gson gson, String content, com.google.gson.reflect.TypeToken<T> typeToken, boolean lenient)
@Nullable public static <T> T deserialize(com.google.gson.Gson gson, String content, Class<T> class2, boolean lenient)
@Environment(value=CLIENT) @Nullable public static <T> T deserialize(com.google.gson.Gson gson, Reader reader, com.google.gson.reflect.TypeToken<T> typeToken)
@Environment(value=CLIENT) @Nullable public static <T> T deserialize(com.google.gson.Gson gson, String content, com.google.gson.reflect.TypeToken<T> typeToken)
@Nullable public static <T> T deserialize(com.google.gson.Gson gson, Reader reader, Class<T> class2)
@Nullable public static <T> T deserialize(com.google.gson.Gson gson, String content, Class<T> class2)
public static com.google.gson.JsonObject deserialize(String content, boolean lenient)
public static com.google.gson.JsonObject deserialize(Reader reader, boolean lenient)
public static com.google.gson.JsonObject deserialize(String content)
public static com.google.gson.JsonObject deserialize(Reader reader)