Interface SettingStore

All Superinterfaces:
SettingSource
All Known Implementing Classes:
FunctionalStore, MapStore

public interface SettingStore extends SettingSource
A writable extension of SettingSource that supports modifying property values.

This interface extends SettingSource with methods for setting, unsetting, and clearing properties. All stores that implement this interface provide read/write access and can be modified at runtime.

Sources vs Stores:

  • Sources (SettingSource) - Provide read-only access to property values
  • Stores (SettingStore) - Provide read/write access to property values
Example:

// Create a writable store MapStore store = new MapStore(); store.set("my.property", "value"); store.unset("my.property"); store.clear();

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clears all settings from this store.
    void
    set(String name, String value)
    Sets a setting in this store.
    void
    unset(String name)
    Removes a setting from this store.

    Methods inherited from interface org.apache.juneau.commons.settings.SettingSource

    get
  • Method Details

    • set

      void set(String name, String value)
      Sets a setting in this store.

      Setting a value to null means that SettingSource.get(String) will return Optional.empty() for that key, effectively overriding any values from lower-priority sources. Use unset(String) if you want SettingSource.get(String) to return null (indicating the key doesn't exist in this store).

      Parameters:
      name - The property name.
      value - The property value, or null to set an empty override.
    • unset

      void unset(String name)
      Removes a setting from this store.

      After calling this method, SettingSource.get(String) will return null for the specified key, indicating that the key doesn't exist in this store (as opposed to returning Optional.empty(), which would indicate the key exists but has a null value).

      Parameters:
      name - The property name to remove.
    • clear

      void clear()
      Clears all settings from this store.

      After calling this method, all keys will be removed from this store, and SettingSource.get(String) will return null for all keys.