ConfigPropertiesUtils¶
-
public final class
ConfigPropertiesUtils
¶ A utility class for loading properties.
Methods¶
createPropertiesConfiguration¶
-
public static PropertiesConfiguration
createPropertiesConfiguration
(String basePath, String fileName)¶ Creates
PropertiesConfiguration
in the given path if it does not existParameters: - basePath – path to the file with config
- fileName – name of the file with config
Returns: PropertiesConfiguration
from the given path
getDefaultPropertiesFile¶
-
public static File
getDefaultPropertiesFile
(ConfigLocation.FileAccessType accessType, Iterable<ConfigLocation> configLocations, String fileName)¶ Returns default config file location.
Parameters: - accessType – the access required for returned File object
- configLocations – the config locations specified by MOTECH in config-locations.properties
- fileName – the file name
getPropertiesFromFile¶
-
public static Properties
getPropertiesFromFile
(File file)¶ Loads the properties from given
File
.Parameters: - file – the file with properties
Throws: - IOException – if I/O error occurred
Returns: the loaded properties
getPropertiesFromSystemVarString¶
-
public static Properties
getPropertiesFromSystemVarString
(String string)¶ Loads the properties from given
String
. The format of thisString
should be “key1=value1;key2=value2;key3=value3;...”.Parameters: - string – the string with properties
Returns: the loaded properties
saveConfig¶
-
public static void
saveConfig
(File file, Properties properties)¶ Saves properties to the given
File
.Parameters: - file – the file
- properties –