public class SettingsManagerImpl extends Object implements SettingsManager
SettingsManager. Use the SettingsManagerBuilder to create instances.
The settings manager unites a property resource,
a migration service and the list of known properties
(typically gathered from SettingsHolder classes).
The settings manager allows to look up and modify properties. Thus, the settings manager fulfills the most typical operations on a configuration in an application. After initializing the settings manager, it is usually the only class from ConfigMe you interact with.
PropertyResource,
ConfigurationData,
MigrationService| Modifier | Constructor and Description |
|---|---|
protected |
SettingsManagerImpl(PropertyResource resource,
ConfigurationData configurationData,
MigrationService migrationService)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected ConfigurationData |
getConfigurationData() |
protected MigrationService |
getMigrationService() |
<T> T |
getProperty(Property<T> property)
Gets the given property from the configuration.
|
protected PropertyResource |
getPropertyResource() |
protected void |
loadFromResourceAndValidate()
Reads the configuration file and executes the migration service (if present).
|
void |
reload()
Reloads the configuration.
|
void |
save()
Saves the properties to the configuration file.
|
<T> void |
setProperty(Property<T> property,
T value)
Sets a new value for the given property.
|
protected SettingsManagerImpl(PropertyResource resource, ConfigurationData configurationData, @Nullable MigrationService migrationService)
SettingsManagerBuilder to create instances.resource - the property resource to read from and write toconfigurationData - the configuration datamigrationService - migration service to check the property resource withpublic <T> T getProperty(Property<T> property)
getProperty in interface SettingsManagerT - The property's typeproperty - The property to retrievepublic <T> void setProperty(Property<T> property, T value)
setProperty in interface SettingsManagerT - The property's typeproperty - The property to modifyvalue - The new value to assign to the propertypublic void reload()
SettingsManagerreload in interface SettingsManagerpublic void save()
SettingsManagersave in interface SettingsManagerprotected void loadFromResourceAndValidate()
protected final PropertyResource getPropertyResource()
protected final ConfigurationData getConfigurationData()
@Nullable protected final MigrationService getMigrationService()
Copyright © 2016–2018 The AuthMe Team. All rights reserved.