Class AbstractWatchableConfig

All Implemented Interfaces:
Config
Direct Known Subclasses:
CommonsConfigImpl, JsonConfigImpl, PreferencesConfigImpl, PropertiesConfigImpl, XmlConfigImpl

@API(status=INTERNAL, since="1.0") public abstract class AbstractWatchableConfig extends AbstractMutableConfig
Base abstract implementation of watchable mutable configuration properties provider.

Extending classes must add WatchableConfig interface and override addListener and removeListener methods making them public and delegating to the protected methods of this class.

Since:
1.0
Version:
1.0, 2025-04
Author:
(w) Iker Hernaez
  • Constructor Details

    • AbstractWatchableConfig

      protected AbstractWatchableConfig(ConfigOptions options)
      Creates a new instance.
      Parameters:
      options - The configuration builder options.
    • AbstractWatchableConfig

      protected AbstractWatchableConfig(ConfigOptions options, MutableConfigOptions mutableOptions)
      Creates a new instance.
      Parameters:
      options - The configuration builder options.
      mutableOptions - The mutable configuration builder options.
  • Method Details

    • getEvents

      protected EventsHandler getEvents()
      Returns the configuration change events handler, if supported by delegated configuration.
      Returns:
      The configuration change events handler.
    • set

      protected void set(String key, @Nullable String value)
      Sets the value of the specified configuration property.
      Overrides:
      set in class AbstractMutableConfig
      Parameters:
      key - The configuration property.
      value - The value to set
      See Also:
    • remove

      protected void remove(String... keys)
      Removes the specified configuration properties.
      Overrides:
      remove in class AbstractMutableConfig
      Parameters:
      keys - The configuration properties.
      See Also:
    • addListener

      protected void addListener(WatchableConfig.Listener listener)
      Registers the specified configuration change events listener.
      Parameters:
      listener - The listener to be called on configuration changes.
      Throws:
      IllegalStateException - If the configuration type does not support event listeners.
      See Also:
    • removeListener

      protected void removeListener(WatchableConfig.Listener listener)
      Unregisters the specified configuration change events listener.
      Parameters:
      listener - The listener to previously registered.
      See Also:
    • notifyLocalChanges

      protected void notifyLocalChanges(String... keys)
      Notifies configuration properties changed through this instance to all registered listeners.
      Parameters:
      keys - The changed local properties.
    • notifyParentChanges

      protected void notifyParentChanges(Set<String> keys)
      Notifies configuration properties changed through parent configuration to all registered listeners.
      Parameters:
      keys - The changed parent properties.