Class PreferencesMutableConfigImpl

All Implemented Interfaces:
Config, MutableConfig, PreferencesMutableConfig, WatchableConfig, EventListener, PreferenceChangeListener

@API(status=INTERNAL, since="1.0") public class PreferencesMutableConfigImpl extends AbstractWatchableConfig implements PreferencesMutableConfig, PreferenceChangeListener
Implementation of MutableConfig based on Java Preferences.
Since:
0.1
Version:
1.0, 2025-05
Author:
(w) Iker Hernaez
See Also:
  • Constructor Details

    • PreferencesMutableConfigImpl

      @API(status=INTERNAL, since="1.0") public PreferencesMutableConfigImpl(@NotNull @NotNull ConfigOptions options, @NotNull @NotNull MutableConfigOptions mutableOptions, @NotNull @NotNull PreferencesConfigOptions preferencesOptions)
      Creates a new instance.
      Parameters:
      options - The configuration builder options.
      mutableOptions - The mutable configuration builder options.
      preferencesOptions - The preferences based configuration builder options.
  • Method Details

    • getPreferences

      @NotNull protected @NotNull Preferences getPreferences()
      Returns the preferences node to use as storage of configuration parameters.
      Returns:
      The preferences node.
    • isEmptyInt

      protected boolean isEmptyInt()
      Returns true if this configuration instance contains no property.

      Parent configuration

      Specified by:
      isEmptyInt in class AbstractConfig
      Returns:
      Returns true if the configuration contains no property.
    • containsInt

      protected boolean containsInt(@NotBlank @NotBlank String key)
      Returns true if the property with the key passed as argument has been configured in this configuration instance.
      Specified by:
      containsInt in class AbstractConfig
      Parameters:
      key - The configuration property.
      Returns:
      Returns true if the property has been configured.
    • getKeysInt

      @NotNull protected @NotNull Stream<String> getKeysInt()
      Returns the configuration property keys contained in this configuration instance .
      Specified by:
      getKeysInt in class AbstractConfig
      Returns:
      The configuration property keys.
    • getInt

      protected String getInt(@NotBlank @NotBlank String key)
      Returns the value of the configuration property as String.
      Specified by:
      getInt in class AbstractConfig
      Parameters:
      key - The configuration property.
      Returns:
      The configuration parameter value.
    • setInt

      protected void setInt(@NotBlank @NotBlank String key, @NotNull @NotNull String value)
      Sets the value of the specified configuration property.
      Specified by:
      setInt in class AbstractMutableConfig
      Parameters:
      key - The configuration property.
      value - The value to set
    • removeInt

      protected void removeInt(@NotBlank @NotBlank String... keys)
      Removes the specified configuration properties.
      Specified by:
      removeInt in class AbstractMutableConfig
      Parameters:
      keys - The configuration properties.
    • preferenceChange

      public void preferenceChange(@NotNull @NotNull PreferenceChangeEvent evt)
      Specified by:
      preferenceChange in interface PreferenceChangeListener
    • notifyLocalChanges

      protected void notifyLocalChanges(@NotNull @NotNull String... keys)
      Notifies configuration properties changed through this instance to all registered listeners.
      Overrides:
      notifyLocalChanges in class AbstractWatchableConfig
      Parameters:
      keys - The changed local properties.
    • sync

      public void sync()
      Synchronizes the configuration properties from the source preferences node.
      Specified by:
      sync in interface PreferencesMutableConfig
      See Also:
    • flush

      public void flush()
      Saves the current configuration properties to the source preferences node.
      Specified by:
      flush in interface PreferencesMutableConfig
      See Also: