Package dev.boze.api.config
Class JsonTools
java.lang.Object
dev.boze.api.config.JsonTools
Interface for saving and loading json objects
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Serializable<T>>
TloadObject
(Addon addon, String fileName, Serializable<T> object) Loads to object from a filestatic boolean
saveObject
(Addon addon, String fileName, Serializable<?> object) Saves an object to a file
-
Constructor Details
-
JsonTools
public JsonTools()
-
-
Method Details
-
saveObject
Saves an object to a file- Parameters:
addon
- The addon to save the object forfileName
- The name of the file to save the object toobject
- The object to save- Returns:
- If the object was saved successfully
-
loadObject
public static <T extends Serializable<T>> T loadObject(Addon addon, String fileName, Serializable<T> object) Loads to object from a file- Parameters:
addon
- The addon to load the object forfileName
- The name of the file to load the object fromobject
- The object to load to- Returns:
- The loaded object, or null if the object failed to load
-