java.lang.Object
dev.orne.config.impl.AbstractConfig
dev.orne.config.impl.AbstractMutableConfig
dev.orne.config.impl.AbstractWatchableConfig
dev.orne.config.impl.CommonsMutableConfigImpl
- All Implemented Interfaces:
Config,MutableConfig,WatchableConfig
@API(status=INTERNAL,
since="1.0")
public class CommonsMutableConfigImpl
extends AbstractWatchableConfig
Implementation of
MutableConfig based on Apache Commons
Configuration.- Since:
- 0.2
- Version:
- 1.0, 2020-09
- Author:
- (w) Iker Hernaez
- See Also:
-
Configuration
-
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
ConstructorsConstructorDescriptionCommonsMutableConfigImpl(@NotNull ConfigOptions options, @NotNull MutableConfigOptions mutableOptions, @NotNull CommonsConfigOptions commonsOptions) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconfigureCommonsEvents(@NotNull org.apache.commons.configuration2.event.EventSource source) Configures reception of Apache Commons events.protected booleancontainsInt(@NotBlank String key) Returnstrueif the property with the key passed as argument has been configured in this configuration instance.protected @NotNull org.apache.commons.configuration2.ConfigurationReturns the delegated Apache Commons configuration.protected StringReturns the value of the configuration property asString.Returns the configuration property keys contained in this configuration instance .protected booleanReturnstrueif this configuration instance contains no property.protected booleanReturnstrueif local events must be suppressed.protected voidnotifyLocalChanges(@NotNull String... keys) Notifies configuration properties changed through this instance to all registered listeners.protected voidprocessCommonsEvent(@NotNull org.apache.commons.configuration2.event.Event event) Processes the specified Apache Commons event.protected voidRemoves the specified configuration properties.protected voidSets the value of the specified configuration property.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.MutableConfig
set, set, setMethods inherited from interface dev.orne.config.WatchableConfig
subset
-
Constructor Details
-
CommonsMutableConfigImpl
public CommonsMutableConfigImpl(@NotNull @NotNull ConfigOptions options, @NotNull @NotNull MutableConfigOptions mutableOptions, @NotNull @NotNull 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
@NotNull protected @NotNull org.apache.commons.configuration2.Configuration getConfig()Returns the delegated Apache Commons configuration.- Returns:
- The delegated Apache Commons configuration
-
isLocalEventsSuppressed
protected boolean isLocalEventsSuppressed()Returnstrueif local events must be suppressed.- Returns:
- If local events must be suppressed.
-
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.
-
getKeysInt
Returns the configuration property keys contained in this configuration instance .- Specified by:
getKeysIntin classAbstractConfig- Returns:
- The configuration property keys.
-
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.
-
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.
-
notifyLocalChanges
Notifies configuration properties changed through this instance to all registered listeners.- Overrides:
notifyLocalChangesin classAbstractWatchableConfig- Parameters:
keys- The changed local properties.
-
configureCommonsEvents
protected void configureCommonsEvents(@NotNull @NotNull org.apache.commons.configuration2.event.EventSource source) Configures reception of Apache Commons events.- Parameters:
source- The Apache Commons events source.
-
processCommonsEvent
protected void processCommonsEvent(@NotNull @NotNull org.apache.commons.configuration2.event.Event event) Processes the specified Apache Commons event.- Parameters:
event- The Apache Commons event.
-