public class SettingsServiceImpl extends Object implements SettingsService
Configurable and Setting annotations. To be recognized by the SettingsManager
configure(java.lang.Object) has to be called for every object that wants to receive settings. All other
classes have to call configure(java.lang.Object) manually.SettingDefinition,
SettingValue,
Configurable| Constructor and Description |
|---|
SettingsServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addSetting(SettingDefinition<?> definition) |
void |
addSettings(Collection<SettingDefinition<?>> definitions) |
void |
changeSetting(SettingValue<?> newValue)
Changes a setting.
|
void |
configure(Object object)
Configure
o with the required settings. |
void |
configureOnce(Object object)
Configure
o with the required settings. |
void |
deleteAll()
Deletes all settings and users.
|
void |
deleteSetting(SettingDefinition<?> setting)
Deletes the setting defined by
setting. |
SettingDefinition<?> |
getDefinitionByKey(String key)
Get the definition that is defined with the specified key.
|
Set<String> |
getKeys() |
<T> SettingValue<T> |
getSetting(SettingDefinition<T> key)
Gets the value of the setting defined by
key. |
<T> SettingValue<T> |
getSetting(String key)
Gets the value of the setting defined by
key. |
Set<SettingDefinition<?>> |
getSettingDefinitions()
Gets all
SettingDefinitions known by this class. |
SettingValueFactory |
getSettingFactory() |
Map<SettingDefinition<?>,SettingValue<?>> |
getSettings()
Gets all values for all definitions.
|
void |
reconfigure()
Gets all values for all definitions and udpates (changes or configures) all configured objets.
|
void |
setServiceEventBus(EventBus serviceEventBus) |
void |
setSettingDefinitions(Optional<Collection<SettingDefinition<?>>> def) |
void |
setSettingsManagerDao(SettingsDao settingsManagerDao) |
void |
setSettingValueFactory(SettingValueFactory settingValueFactory) |
@Inject public void setServiceEventBus(EventBus serviceEventBus)
@Inject public void setSettingValueFactory(SettingValueFactory settingValueFactory)
@Inject public void setSettingsManagerDao(SettingsDao settingsManagerDao)
@Inject public void setSettingDefinitions(Optional<Collection<SettingDefinition<?>>> def)
public void addSetting(SettingDefinition<?> definition)
addSetting in interface SettingsServicepublic void addSettings(Collection<SettingDefinition<?>> definitions)
addSettings in interface SettingsServicepublic Set<SettingDefinition<?>> getSettingDefinitions()
SettingDefinitions known by this class.getSettingDefinitions in interface SettingsServicepublic void configureOnce(Object object) throws ConfigurationError
SettingsServiceo with the required settings. Future changes to settings will not be propagated to the object.configureOnce in interface SettingsServiceobject - the object to configureConfigurationError - if there is a problem configuring the objectSettingsService.configure(java.lang.Object)public void configure(Object object) throws ConfigurationError
o with the required settings. All changes to a setting required by the object will be applied.configure in interface SettingsServiceobject - the object to configureConfigurationError - if there is a problem configuring the objectConfigurable,
Settingpublic SettingDefinition<?> getDefinitionByKey(String key)
getDefinitionByKey in interface SettingsServicekey - the keynull if there is no definition for the keypublic <T> SettingValue<T> getSetting(SettingDefinition<T> key)
key.getSetting in interface SettingsServiceT - the type of the setting and valuekey - the definition of the settingpublic <T> SettingValue<T> getSetting(String key)
key.getSetting in interface SettingsServiceT - the type of the setting and valuekey - the id of the settingpublic Map<SettingDefinition<?>,SettingValue<?>> getSettings()
null is added to the map.getSettings in interface SettingsServicepublic void deleteSetting(SettingDefinition<?> setting) throws ConfigurationError
setting.deleteSetting in interface SettingsServicesetting - the definitionConfigurationError - if there is a problem deleting the settingpublic Set<String> getKeys()
getKeys in interface SettingsServicepublic void changeSetting(SettingValue<?> newValue) throws ConfigurationError
changeSetting in interface SettingsServicenewValue - the new value of the settingConfigurationError - if there is a problem changing the setting.public SettingValueFactory getSettingFactory()
getSettingFactory in interface SettingsServiceSettingValueFactory to produce valuespublic void deleteAll()
deleteAll in interface SettingsServicepublic void reconfigure()
SettingsServicereconfigure in interface SettingsServiceCopyright © 2015–2021 52North Initiative for Geospatial Open Source Software GmbH. All rights reserved.