Package emu.grasscutter.utils
Class JsonUtils
java.lang.Object
emu.grasscutter.utils.JsonUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Tstatic <T> TSafely JSON decodes a given string.static <T> Tstatic Stringstatic <T> TloadToClass(Reader fileReader, Class<T> classType) static <T> TloadToClass(String filename, Class<T> classType) Deprecated, for removal: This API element is subject to removal in a future version.static <T> TloadToClass(Path filename, Class<T> classType) static <T> List<T>loadToList(Reader fileReader, Class<T> classType) static <T> List<T>loadToList(String filename, Class<T> classType) Deprecated, for removal: This API element is subject to removal in a future version.static <T> List<T>loadToList(Path filename, Class<T> classType) static <T1,T2> Map<T1, T2> static <T1,T2> Map<T1, T2> Deprecated, for removal: This API element is subject to removal in a future version.static <T1,T2> Map<T1, T2>
-
Constructor Details
-
JsonUtils
public JsonUtils()
-
-
Method Details
-
encode
-
decode
public static <T> T decode(com.google.gson.JsonElement jsonElement, Class<T> classType) throws com.google.gson.JsonSyntaxException - Throws:
com.google.gson.JsonSyntaxException
-
loadToClass
- Throws:
IOException
-
loadToClass
@Deprecated(forRemoval=true) public static <T> T loadToClass(String filename, Class<T> classType) throws IOException Deprecated, for removal: This API element is subject to removal in a future version.- Throws:
IOException
-
loadToClass
- Throws:
IOException
-
loadToList
- Throws:
IOException
-
loadToList
@Deprecated(forRemoval=true) public static <T> List<T> loadToList(String filename, Class<T> classType) throws IOException Deprecated, for removal: This API element is subject to removal in a future version.- Throws:
IOException
-
loadToList
- Throws:
IOException
-
loadToMap
public static <T1,T2> Map<T1,T2> loadToMap(Reader fileReader, Class<T1> keyType, Class<T2> valueType) throws IOException - Throws:
IOException
-
loadToMap
@Deprecated(forRemoval=true) public static <T1,T2> Map<T1,T2> loadToMap(String filename, Class<T1> keyType, Class<T2> valueType) throws IOException Deprecated, for removal: This API element is subject to removal in a future version.- Throws:
IOException
-
loadToMap
public static <T1,T2> Map<T1,T2> loadToMap(Path filename, Class<T1> keyType, Class<T2> valueType) throws IOException - Throws:
IOException
-
decode
Safely JSON decodes a given string.- Parameters:
jsonData- The JSON-encoded data.- Returns:
- JSON decoded data, or null if an exception occurred.
-
decode
-