-
- 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
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static java.util.Optional<SettingsService>
create()
Returns an instance ofSettingsService
.void
remove(java.lang.String key)
Removes the setting for the specified key.java.lang.String
retrieve(java.lang.String key)
Retrieves the value of the setting that is identified by the specified key.void
store(java.lang.String key, java.lang.String value)
Stores the setting with the specified key and value.
-
-
-
Method Detail
-
create
static java.util.Optional<SettingsService> create()
Returns an instance ofSettingsService
.- Returns:
- An instance of
SettingsService
.
-
store
void store(java.lang.String key, java.lang.String value)
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
void remove(java.lang.String key)
Removes the setting for the specified key.- Parameters:
key
- the key of the setting that needs to be removed
-
retrieve
java.lang.String retrieve(java.lang.String key)
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
null
when no setting was stored with the specified key
-
-