public class Config extends Object
| Constructor and Description |
|---|
Config()Default constructor |
| Modifier and Type | Method and Description |
|---|---|
static Properties | getProperties()Returns the properties, sorted, WITHOUT the prefix |
static String | getProperty(String name)Get a property by name, checking system properties first,
then the config file, then the default properties. |
static int | getProperty(String name,
int defaultValue)Get a property as an integer with a default value. |
static String | getProperty(String name,
String defaultValue)Get a property by name with a default value. |
static boolean | hasConfigFile()Don't bother showing a reload config button if this returns false. |
static void | reloadConfiguration()Reload the configuration from the properties resource and the
susimail.config file in the config directory. |
static void | saveConfiguration(Properties newProps)Saves the properties. |
static void | setPrefix(String prefix)Set the configuration key prefix. |
public static Properties getProperties()
public static String getProperty(String name)
name - the property name (prefix will be added if set)public static int getProperty(String name, int defaultValue)
name - the property namedefaultValue - the value to return if the property is not found or not a valid integerpublic static String getProperty(String name, String defaultValue)
name - the property namedefaultValue - the value to return if the property is not foundpublic static boolean hasConfigFile()
public static void reloadConfiguration()
public static void saveConfiguration(Properties newProps) throws IOException
newProps - non-null WITHOUT the prefixIOException - if the save failspublic static void setPrefix(String prefix)
prefix - the prefix to prepend to property names