public class TextComponentJsonUtils
extends java.lang.Object
| Constructor and Description |
|---|
TextComponentJsonUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
getBoolean(com.google.gson.JsonElement element,
java.lang.String key)
Get a boolean value from a json element.
|
static boolean |
getBoolean(com.google.gson.JsonObject object,
java.lang.String key)
Get a boolean value from a json object.
|
static boolean |
getBoolean(com.google.gson.JsonObject object,
java.lang.String key,
boolean fallback)
Get a boolean value from a json object with a default value.
|
static int |
getInt(com.google.gson.JsonElement element,
java.lang.String key)
Get a int value from a json element.
|
static int |
getInt(com.google.gson.JsonObject object,
java.lang.String key)
Get a int value from a json object.
|
static int |
getInt(com.google.gson.JsonObject object,
java.lang.String key,
int fallback)
Get a int value from a json object with a default value.
|
static com.google.gson.JsonObject |
getJsonObject(com.google.gson.JsonElement element,
java.lang.String key)
Get a json object value from a json element.
|
static com.google.gson.JsonObject |
getJsonObject(com.google.gson.JsonObject object,
java.lang.String key)
Get a json object value from a json object.
|
static java.lang.String |
getString(com.google.gson.JsonElement element,
java.lang.String key)
Get a string value from a json element.
|
static java.lang.String |
getString(com.google.gson.JsonObject object,
java.lang.String key)
Get a string value from a json object.
|
static java.lang.String |
getString(com.google.gson.JsonObject object,
java.lang.String key,
java.lang.String fallback)
Get a string value from a json object with a default value.
|
public static boolean getBoolean(com.google.gson.JsonElement element,
java.lang.String key)
element - The element to get the value fromkey - The key of the valuecom.google.gson.JsonSyntaxException - If the value is not a json primitive booleanpublic static boolean getBoolean(com.google.gson.JsonObject object,
java.lang.String key)
object - The object to get the value fromkey - The key of the valuecom.google.gson.JsonSyntaxException - If the json object does not contain the key or the value is not a json primitive booleanpublic static boolean getBoolean(com.google.gson.JsonObject object,
java.lang.String key,
boolean fallback)
object - The object to get the value fromkey - The key of the valuefallback - The default valuecom.google.gson.JsonSyntaxException - If the value is not a json primitive booleanpublic static int getInt(com.google.gson.JsonElement element,
java.lang.String key)
element - The element to get the value fromkey - The key of the valuecom.google.gson.JsonSyntaxException - If the value is not a json primitive intpublic static int getInt(com.google.gson.JsonObject object,
java.lang.String key)
object - The object to get the value fromkey - The key of the valuecom.google.gson.JsonSyntaxException - If the json object does not contain the key or the value is not a json primitive intpublic static int getInt(com.google.gson.JsonObject object,
java.lang.String key,
int fallback)
object - The object to get the value fromkey - The key of the valuefallback - The default valuecom.google.gson.JsonSyntaxException - If the value is not a json primitive intpublic static java.lang.String getString(com.google.gson.JsonElement element,
java.lang.String key)
element - The element to get the value fromkey - The key of the valuecom.google.gson.JsonSyntaxException - If the value is not a json primitive stringpublic static java.lang.String getString(com.google.gson.JsonObject object,
java.lang.String key)
object - The object to get the value fromkey - The key of the valuecom.google.gson.JsonSyntaxException - If the json object does not contain the key or the value is not a json primitive stringpublic static java.lang.String getString(com.google.gson.JsonObject object,
java.lang.String key,
java.lang.String fallback)
object - The object to get the value fromkey - The key of the valuefallback - The default valuecom.google.gson.JsonSyntaxException - If the value is not a json primitive stringpublic static com.google.gson.JsonObject getJsonObject(com.google.gson.JsonElement element,
java.lang.String key)
element - The element to get the value fromkey - The key of the valuecom.google.gson.JsonSyntaxException - If the value is not a json objectpublic static com.google.gson.JsonObject getJsonObject(com.google.gson.JsonObject object,
java.lang.String key)
object - The object to get the value fromkey - The key of the valuecom.google.gson.JsonSyntaxException - If the json object does not contain the key or the value is not a json object