Class CommonsMutableConfigImpl

All Implemented Interfaces:
Config, MutableConfig, WatchableConfig

@API(status=INTERNAL, since="1.0") public class CommonsMutableConfigImpl extends CommonsConfigImpl implements WatchableConfig
Implementation of MutableConfig based on Apache Commons Configuration.
Since:
0.2
Version:
1.0, 2020-09
Author:
(w) Iker Hernaez
See Also:
  • Configuration
  • Constructor Details

    • CommonsMutableConfigImpl

      public CommonsMutableConfigImpl(ConfigOptions options, MutableConfigOptions mutableOptions, CommonsConfigOptions commonsOptions)
      Creates a new instance.
      Parameters:
      options - The configuration builder options.
      mutableOptions - The mutable configuration builder options.
      commonsOptions - The Apache Commons based configuration options.
  • Method Details

    • getConfig

      protected org.apache.commons.configuration2.Configuration getConfig()
      Returns the delegated Apache Commons configuration.
      Overrides:
      getConfig in class CommonsConfigImpl
      Returns:
      The delegated Apache Commons configuration
    • isLocalEventsSuppressed

      protected boolean isLocalEventsSuppressed()
      Returns true if local events must be suppressed.
      Returns:
      If local events must be suppressed.
    • set

      public void set(String key, @Nullable String value)
      Sets the value of the specified configuration property.
      Specified by:
      set in interface MutableConfig
      Overrides:
      set in class AbstractWatchableConfig
      Parameters:
      key - The configuration property.
      value - The value to set
      See Also:
    • setInt

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

      public void remove(String... keys)
      Removes the specified configuration properties.
      Specified by:
      remove in interface MutableConfig
      Overrides:
      remove in class AbstractWatchableConfig
      Parameters:
      keys - The configuration properties.
      See Also:
    • removeInt

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

      public void addListener(WatchableConfig.Listener listener)
      Registers the specified configuration change events listener.
      Specified by:
      addListener in interface WatchableConfig
      Overrides:
      addListener in class AbstractWatchableConfig
      Parameters:
      listener - The listener to be called on configuration changes.
      See Also:
    • removeListener

      public void removeListener(WatchableConfig.Listener listener)
      Unregisters the specified configuration change events listener.
      Specified by:
      removeListener in interface WatchableConfig
      Overrides:
      removeListener in class AbstractWatchableConfig
      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.
      Overrides:
      notifyLocalChanges in class AbstractWatchableConfig
      Parameters:
      keys - The changed local properties.
    • configureCommonsEvents

      protected void configureCommonsEvents(org.apache.commons.configuration2.event.EventSource source)
      Configures reception of Apache Commons events.
      Parameters:
      source - The Apache Commons events source.
    • processCommonsEvent

      protected void processCommonsEvent(org.apache.commons.configuration2.event.Event event)
      Processes the specified Apache Commons event.
      Parameters:
      event - The Apache Commons event.