Package com.aliucord
Class SettingsUtilsJSON
-
- All Implemented Interfaces:
public final class SettingsUtilsJSON
Utility class to store and retrieve preferences
-
-
Constructor Summary
Constructors Constructor Description SettingsUtilsJSON(String plugin)
-
Method Summary
Modifier and Type Method Description final Boolean
resetFile()
Resets All Settings final Boolean
toggleBool(String key, Boolean defVal)
Toggles Boolean and returns it final Boolean
remove(String key)
Removes Item from settings final List<String>
getAllKeys()
Gets All Keys from settings final Boolean
exists(String key)
Check if Key exists in settings final Boolean
getBool(String key, Boolean defValue)
Get a boolean from the preferences final Unit
setBool(String key, Boolean value)
Set a boolean item final Integer
getInt(String key, Integer defValue)
Get an int from the preferences final Unit
setInt(String key, Integer value)
Set an int item final Float
getFloat(String key, Float defValue)
Get a float from the preferences final Unit
setFloat(String key, Float value)
Set a float item final Long
getLong(String key, Long defValue)
Get a long from the preferences final Unit
setLong(String key, Long value)
Set a long item final String
getString(String key, String defValue)
Get a String from the preferences final Unit
setString(String key, String value)
Set a String item final JSONObject
getJSONObject(String key, JSONObject defValue)
Get a JSONObject item final Unit
setJSONObject(String key, JSONObject value)
Set a JSONObject item final <T extends Any> T
getObject(String key, T defValue)
Get an Object from the preferences final <T extends Any> T
getObject(String key, T defValue, Type type)
Get an Object from the preferences final Unit
setObject(String key, Object value)
Set an Object item -
-
Constructor Detail
-
SettingsUtilsJSON
SettingsUtilsJSON(String plugin)
-
-
Method Detail
-
toggleBool
final Boolean toggleBool(String key, Boolean defVal)
Toggles Boolean and returns it
- Parameters:
key
- Key of the valuedefVal
- Default Value if setting doesn't exist
-
remove
@Synchronized() final Boolean remove(String key)
Removes Item from settings
- Parameters:
key
- Key of the value
-
getAllKeys
final List<String> getAllKeys()
Gets All Keys from settings
-
exists
final Boolean exists(String key)
Check if Key exists in settings
- Parameters:
key
- Key of the value
-
getBool
final Boolean getBool(String key, Boolean defValue)
Get a boolean from the preferences
- Parameters:
key
- Key of the valuedefValue
- Default value
-
setBool
final Unit setBool(String key, Boolean value)
Set a boolean item
- Parameters:
key
- Key of the itemvalue
- Value
-
getInt
final Integer getInt(String key, Integer defValue)
Get an int from the preferences
- Parameters:
key
- Key of the valuedefValue
- Default value
-
setInt
final Unit setInt(String key, Integer value)
Set an int item
- Parameters:
key
- Key of the itemvalue
- Value
-
getFloat
final Float getFloat(String key, Float defValue)
Get a float from the preferences
- Parameters:
key
- Key of the valuedefValue
- Default value
-
setFloat
final Unit setFloat(String key, Float value)
Set a float item
- Parameters:
key
- Key of the itemvalue
- Value
-
getLong
final Long getLong(String key, Long defValue)
Get a long from the preferences
- Parameters:
key
- Key of the valuedefValue
- Default value
-
setLong
final Unit setLong(String key, Long value)
Set a long item
- Parameters:
key
- Key of the itemvalue
- Value
-
getString
final String getString(String key, String defValue)
Get a String from the preferences
- Parameters:
key
- Key of the valuedefValue
- Default value
-
setString
final Unit setString(String key, String value)
Set a String item
- Parameters:
key
- Key of the itemvalue
- Value
-
getJSONObject
final JSONObject getJSONObject(String key, JSONObject defValue)
Get a JSONObject item
- Parameters:
key
- Key of the itemdefValue
- Default value
-
setJSONObject
final Unit setJSONObject(String key, JSONObject value)
Set a JSONObject item
- Parameters:
key
- Key of the itemvalue
- Value
-
getObject
final <T extends Any> T getObject(String key, T defValue)
Get an Object from the preferences
- Parameters:
key
- Key of the valuedefValue
- Default value
-
getObject
final <T extends Any> T getObject(String key, T defValue, Type type)
Get an Object from the preferences
- Parameters:
key
- Key of the valuedefValue
- Default valuetype
- Type of the object
-
-
-
-