Interface SettingsService

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 Details

    • create

      static Optional<SettingsService> create()
      Returns an instance of SettingsService.
      Returns:
      An instance of SettingsService.
    • store

      void store(String key, 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 setting
      value - the value associated with the key
    • remove

      void remove(String key)
      Removes the setting for the specified key.
      Parameters:
      key - the key of the setting that needs to be removed
    • retrieve

      String retrieve(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