Modifier and Type | Field and Description |
---|---|
private static Config |
__config |
private static boolean |
__fileExists |
private static String |
__filename |
private static boolean |
__initialized |
private static long |
__lastModified |
private static Logger |
__logger |
private static Model |
__model |
private Map<String,DefinitionAndValue> |
_definitionAndValues |
Modifier | Constructor and Description |
---|---|
private |
Config() |
Modifier and Type | Method and Description |
---|---|
(package private) static Map<String,Object> |
__extractValues(Map<String,DefinitionAndValue> definitionAndValues) |
(package private) static Map<String,DefinitionAndValue> |
__read()
Read configuration file
|
private void |
_load() |
private void |
_reloadIfNeeded() |
static void |
dispose()
Dispose this
Config instance |
static boolean |
fileExists()
Returns true if the configuration filename exists.
|
static Config |
getInstance()
Get the instance of Config using the config file.
|
<T> T |
getValue(String name)
Retrieves the typed parameter value
|
<T> T |
getValue(String name,
boolean useDefaultFromModel,
T defaultValue)
Retrieves the typed parameter value, or the default value
|
Map<String,Object> |
getValues()
Retrieves all configuration parameter values
|
static Map<String,Object> |
getValuesAsJSONForClient()
Retrieves all configuration parameter values as JSON objects
|
static void |
setFilename(String filename)
Set the configuration filename
|
static void |
setInitialized(boolean initialized)
Set the initialization status of the configuration
|
static void |
setModel(Model model)
Sets the configuration model
|
private static boolean __initialized
private static String __filename
private static boolean __fileExists
private static long __lastModified
private Map<String,DefinitionAndValue> _definitionAndValues
private Config()
public static Config getInstance()
public static void setModel(Model model)
model
- the model to setprivate void _reloadIfNeeded()
static Map<String,DefinitionAndValue> __read() throws Exception
Exception
- if a problem occurs reading valuespublic static void setInitialized(boolean initialized)
initialized
- the initialization status of the configurationpublic static void setFilename(String filename)
filename
- Name with path of the configuration filepublic static boolean fileExists()
public Map<String,Object> getValues()
static Map<String,Object> __extractValues(Map<String,DefinitionAndValue> definitionAndValues)
public static Map<String,Object> getValuesAsJSONForClient()
public <T> T getValue(String name)
T
- type of the value to retrievename
- name of the configuration parameterpublic <T> T getValue(String name, boolean useDefaultFromModel, T defaultValue)
T
- type of the value to retrievename
- name of the configuration parameteruseDefaultFromModel
- true to use the default value from the model, false to use the give default valuedefaultValue
- default value used if value is null and useDefaultFromModel is false, or if there is no default value on model