- All Known Implementing Classes:
AndroidSettingsService,DesktopSettingsService,DummySettingsService,IOSSettingsService
public interface SettingsService
The SettingService provides a simple way for storing, retrieving and removing
key-value pairs of strings.
Example
SettingsService.create().ifPresent(service -> {
service.store("key", "value");
String value = service.retrieve("key");
service.remove("key");
});
Android Configuration: none
iOS Configuration: none
- Since:
- 3.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<SettingsService>create()Returns an instance ofSettingsService.voidRemoves the setting for the specified key.Retrieves the value of the setting that is identified by the specified key.voidStores the setting with the specified key and value.
-
Method Details
-
create
Returns an instance ofSettingsService.- Returns:
- An instance of
SettingsService.
-
store
Stores the setting with the specified key and value. If a setting with the specified key exists, the value for that setting will be overwritten with the specified value.- Parameters:
key- a key that uniquely identifies the settingvalue- the value associated with the key
-
remove
Removes the setting for the specified key.- Parameters:
key- the key of the setting that needs to be removed
-
retrieve
Retrieves the value of the setting that is identified by the specified key.- Parameters:
key- the key of the setting to look up- Returns:
- the value associated with the setting or
nullwhen no setting was stored with the specified key
-