Config
Index
Constructors
constructor
Methods
access
Same as Config.get.
Type parameters
- T = string | number | boolean | Config | JSONArray
Parameters
name: string
Returns T
checkAndRestore
Ensures that config has all the properties the data pattern contains, if not, puts default values to match the pattern.
Parameters
jsonstr: string
string representation of JSON object representing the data pattern
Returns void
get
Gets property from the config.
Type parameters
- T = string | number | boolean | Config | JSONArray
Parameters
name: string
option name, supports multi-layer calls, separated by '.'
Returns T
Config instance with current config as parent if the property is object, org.json.JSONArray instance if the property is an array, raw type if the property is of that raw type,
null
otherwise.
getBool
Parameters
name: string
option name, supports multi-layer calls, separated by '.'
Returns boolean
Boolean config value specified in config or false if no value was specified.
getDouble
Parameters
name: string
option name, supports multi-layer calls, separated by '.'
Returns number
Double number of value by given name from the config, or
0.0
if no value was specified.
getFloat
Parameters
name: string
option name, supports multi-layer calls, separated by '.'
Returns number
Floating-point number of value by given name from the config, or
0.0
if no value was specified.
getInteger
Parameters
name: string
option name, supports multi-layer calls, separated by '.'
Returns number
Integer of value by given name from the config, or
0
if no value was specified.
getNames
Returns ArrayList<string>
Read-only ArrayList instance containing all the names in the current config file.
getNumber
Parameters
name: string
option name, supports multi-layer calls, separated by '.'
Returns Number
Number object instance, containing numeric value by given name from the config, or
0
if no value was specified.
getPath
Returns string
getString
Parameters
name: string
option name, supports multi-layer calls, separated by '.'
Returns string
String by given name from the config, or
null
if no value was specified.
getValue
Parameters
path: string
option name, supports multi-layer calls, separated by '.'
Returns ConfigValue
Editable Config.ConfigValue instance that can be used to manipulate this config option separately.
reload
Returns void
save
Writes configuration JSON to the file.
Returns void
set
Sets config value. Do not use org.json.JSONObject instances to create nested objects, consider using dot-separated names instead.
Type parameters
- T = string | number | boolean | JSONArray | JSONObject
Parameters
name: string
option name, supports multi-layer calls, separated by '.'
val: T
value, may be org.json.JSONArray instance, org.json.JSONObject instance or raw data type
Returns boolean
Json configuration file reading/writing utility.