java.lang.Object
dev.orne.config.impl.AbstractConfig
dev.orne.config.impl.AbstractMutableConfig
dev.orne.config.impl.AbstractWatchableConfig
dev.orne.config.impl.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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.orne.config.WatchableConfig
WatchableConfig.Listener -
Field Summary
Fields inherited from class dev.orne.config.impl.AbstractConfig
KEY_BLANK_ERR -
Constructor Summary
ConstructorsConstructorDescriptionPreferencesMutableConfigImpl(@NotNull ConfigOptions options, @NotNull MutableConfigOptions mutableOptions, @NotNull PreferencesConfigOptions preferencesOptions) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancontainsInt(@NotBlank String key) Returnstrueif the property with the key passed as argument has been configured in this configuration instance.voidflush()Saves the current configuration properties to the source preferences node.protected StringReturns the value of the configuration property asString.Returns the configuration property keys contained in this configuration instance .protected @NotNull PreferencesReturns the preferences node to use as storage of configuration parameters.protected booleanReturnstrueif this configuration instance contains no property.protected voidnotifyLocalChanges(@NotNull String... keys) Notifies configuration properties changed through this instance to all registered listeners.voidpreferenceChange(@NotNull PreferenceChangeEvent evt) protected voidRemoves the specified configuration properties.protected voidSets the value of the specified configuration property.voidsync()Synchronizes the configuration properties from the source preferences node.Methods inherited from class dev.orne.config.impl.AbstractWatchableConfig
addListener, getEvents, notifyParentChanges, remove, removeListener, setMethods inherited from class dev.orne.config.impl.AbstractMutableConfig
getEncoderMethods inherited from class dev.orne.config.impl.AbstractConfig
contains, get, getDecoder, getDecorator, getKeys, getParent, getResolver, getUndecored, isEmpty, isOverrideParentPropertiesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.orne.config.Config
as, contains, get, get, get, getBoolean, getBoolean, getBoolean, getInteger, getInteger, getInteger, getKeys, getKeys, getKeys, getLong, getLong, getLong, getParent, getUndecored, isEmptyMethods inherited from interface dev.orne.config.WatchableConfig
addListener, removeListener, subset
-
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
Returns the preferences node to use as storage of configuration parameters.- Returns:
- The preferences node.
-
isEmptyInt
protected boolean isEmptyInt()Returnstrueif this configuration instance contains no property.Parent configuration
- Specified by:
isEmptyIntin classAbstractConfig- Returns:
- Returns
trueif the configuration contains no property.
-
containsInt
Returnstrueif the property with the key passed as argument has been configured in this configuration instance.- Specified by:
containsIntin classAbstractConfig- Parameters:
key- The configuration property.- Returns:
- Returns
trueif the property has been configured.
-
getKeysInt
Returns the configuration property keys contained in this configuration instance .- Specified by:
getKeysIntin classAbstractConfig- Returns:
- The configuration property keys.
-
getInt
Returns the value of the configuration property asString.- Specified by:
getIntin classAbstractConfig- Parameters:
key- The configuration property.- Returns:
- The configuration parameter value.
-
setInt
Sets the value of the specified configuration property.- Specified by:
setIntin classAbstractMutableConfig- Parameters:
key- The configuration property.value- The value to set
-
removeInt
Removes the specified configuration properties.- Specified by:
removeIntin classAbstractMutableConfig- Parameters:
keys- The configuration properties.
-
preferenceChange
- Specified by:
preferenceChangein interfacePreferenceChangeListener
-
notifyLocalChanges
Notifies configuration properties changed through this instance to all registered listeners.- Overrides:
notifyLocalChangesin classAbstractWatchableConfig- Parameters:
keys- The changed local properties.
-
sync
public void sync()Synchronizes the configuration properties from the source preferences node.- Specified by:
syncin interfacePreferencesMutableConfig- See Also:
-
flush
public void flush()Saves the current configuration properties to the source preferences node.- Specified by:
flushin interfacePreferencesMutableConfig- See Also:
-