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(@NotNull PropertyResource resource,
@NotNull ConfigurationData configurationData,
@Nullable MigrationService migrationService)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected @NotNull ConfigurationData |
getConfigurationData() |
protected @Nullable MigrationService |
getMigrationService() |
<T> T |
getProperty(@NotNull Property<T> property)
Gets the given property from the configuration.
|
protected @NotNull 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(@NotNull Property<T> property,
T value)
Sets a new value for the given property.
|
protected SettingsManagerImpl(@NotNull
@NotNull PropertyResource resource,
@NotNull
@NotNull ConfigurationData configurationData,
@Nullable
@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 with@NotNull
public <T> T getProperty(@NotNull
@NotNull Property<T> property)
getProperty in interface SettingsManagerT - the property's typeproperty - the property to retrievepublic <T> void setProperty(@NotNull
@NotNull Property<T> property,
@NotNull
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()
@NotNull protected final @NotNull PropertyResource getPropertyResource()
@NotNull protected final @NotNull ConfigurationData getConfigurationData()
@Nullable protected final @Nullable MigrationService getMigrationService()
Copyright © 2016–2023 The AuthMe Team. All rights reserved.