java.lang.Object
dev.orne.config.impl.AbstractConfig
dev.orne.config.impl.AbstractMutableConfig
dev.orne.config.impl.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
-
Field Summary
Fields inherited from class dev.orne.config.impl.AbstractConfig
KEY_BLANK_ERR -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractWatchableConfig(ConfigOptions options) Creates a new instance.protectedAbstractWatchableConfig(ConfigOptions options, MutableConfigOptions mutableOptions) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddListener(WatchableConfig.Listener listener) Registers the specified configuration change events listener.protected EventsHandlerReturns the configuration change events handler, if supported by delegated configuration.protected voidnotifyLocalChanges(String... keys) Notifies configuration properties changed through this instance to all registered listeners.protected voidnotifyParentChanges(Set<String> keys) Notifies configuration properties changed through parent configuration to all registered listeners.protected voidRemoves the specified configuration properties.protected voidremoveListener(WatchableConfig.Listener listener) Unregisters the specified configuration change events listener.protected voidSets the value of the specified configuration property.Methods inherited from class dev.orne.config.impl.AbstractMutableConfig
getEncoder, removeInt, setIntMethods inherited from class dev.orne.config.impl.AbstractConfig
contains, containsInt, get, getDecoder, getDecorator, getInt, getKeys, getKeysInt, getParent, getResolver, getUndecored, isEmpty, isEmptyInt, 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, get, get, getBoolean, getBoolean, getBoolean, getInteger, getInteger, getInteger, getKeys, getKeys, getLong, getLong, getLong, subset
-
Constructor Details
-
AbstractWatchableConfig
Creates a new instance.- Parameters:
options- The configuration builder options.
-
AbstractWatchableConfig
Creates a new instance.- Parameters:
options- The configuration builder options.mutableOptions- The mutable configuration builder options.
-
-
Method Details
-
getEvents
Returns the configuration change events handler, if supported by delegated configuration.- Returns:
- The configuration change events handler.
-
set
Sets the value of the specified configuration property.- Overrides:
setin classAbstractMutableConfig- Parameters:
key- The configuration property.value- The value to set- See Also:
-
remove
Removes the specified configuration properties.- Overrides:
removein classAbstractMutableConfig- Parameters:
keys- The configuration properties.- See Also:
-
addListener
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
Unregisters the specified configuration change events listener.- Parameters:
listener- The listener to previously registered.- See Also:
-
notifyLocalChanges
Notifies configuration properties changed through this instance to all registered listeners.- Parameters:
keys- The changed local properties.
-
notifyParentChanges
Notifies configuration properties changed through parent configuration to all registered listeners.- Parameters:
keys- The changed parent properties.
-