public class MapConfigurationBackend extends Object implements ConfigurationBackend
Map.| Constructor and Description |
|---|
MapConfigurationBackend()
Creates a new configuration backend.
|
MapConfigurationBackend(File configurationFile)
Creates a new configuration backend that loads and stores its
configuration in the given file.
|
MapConfigurationBackend(File configurationFile,
boolean ignoreMissing)
Creates a new configuration backend from the given file.
|
MapConfigurationBackend(File configurationFile,
boolean ignoreMissing,
Map<String,String> values)
Creates a new configuration backend from the given file that also
contains the given values.
|
MapConfigurationBackend(File configurationFile,
Map<String,String> values)
Creates a new configuration backend from the given file that also
contains the given values.
|
MapConfigurationBackend(Map<String,String> values)
Creates a new configuration backend that contains the values from the
given map.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getValue(String attribute)
Returns the value of the given attribute from the backend.
|
void |
putValue(String attribute,
String value)
Sets the value of the given attribute within the backend.
|
void |
save()
Saves the configuration.
|
void |
saveValues()
Saves the configuration to the configuration file, if it is not
null. |
public MapConfigurationBackend()
public MapConfigurationBackend(Map<String,String> values)
values - The initial valuespublic MapConfigurationBackend(File configurationFile) throws ConfigurationException
configurationFile - The file to store the configuration inConfigurationException - if the configuration can not be loaded from the filepublic MapConfigurationBackend(File configurationFile, Map<String,String> values) throws ConfigurationException
configurationFile - The file to store the configuration invalues - Additional initial valuesConfigurationException - if the configuration can not be loaded from the filepublic MapConfigurationBackend(File configurationFile, boolean ignoreMissing) throws ConfigurationException
configurationFile - The file to store the configuration inignoreMissing - true to ignore a missing configuration file when
loading the configurationConfigurationException - if the configuration can not be loaded from the filepublic MapConfigurationBackend(File configurationFile, boolean ignoreMissing, Map<String,String> values) throws ConfigurationException
configurationFile - The file to store the configuration inignoreMissing - true to ignore a missing configuration file when
loading the configurationvalues - Additional initial valuesConfigurationException - if the configuration can not be loaded from the filepublic String getValue(String attribute) throws ConfigurationException
getValue in interface ConfigurationBackendattribute - The name of the attributeConfigurationException - if the attribute could not be foundConfigurationBackend.getValue(java.lang.String)public void putValue(String attribute, String value) throws ConfigurationException
putValue in interface ConfigurationBackendattribute - The name of the attribute to setvalue - The string representation of the valueConfigurationException - if the value could not be setConfigurationBackend.putValue(java.lang.String,
java.lang.String)public void save()
throws ConfigurationException
save in interface ConfigurationBackendConfigurationException - if the configuration could not be savedpublic void saveValues()
throws ConfigurationException
null. If no configuration file has been set, this method simply
returns.ConfigurationException - if there was an error when writing the configurationCopyright © 2026. All rights reserved.