java.lang.Object
dev.orne.config.impl.AbstractConfig
dev.orne.config.impl.AbstractMutableConfig
dev.orne.config.impl.AbstractWatchableConfig
dev.orne.config.impl.JsonMutableConfigImpl
- All Implemented Interfaces:
Config,FileMutableConfig,FileWatchableConfig,MutableConfig,WatchableConfig
- Direct Known Subclasses:
YamlMutableConfigImpl
@API(status=INTERNAL,
since="1.0")
public class JsonMutableConfigImpl
extends AbstractWatchableConfig
implements FileWatchableConfig
Jackson
ObjectNode based mutable configuration.- Since:
- 1.0
- Version:
- 1.0, 2025-07
- Author:
- (w) Iker Hernaez
- See Also:
-
ConfigObjectNode
-
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
ConstructorsConstructorDescriptionJsonMutableConfigImpl(@NotNull ConfigOptions options, @NotNull MutableConfigOptions mutableOptions, @NotNull JsonConfigOptions jsonOptions) 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.protected StringReturns the value of the configuration property asString.protected @NotNull com.fasterxml.jackson.databind.node.ObjectNodeReturns the JSON object with the configuration properties.Returns the configuration property keys contained in this configuration instance .protected @NotEmpty StringReturns the configuration nested properties separator.protected booleanReturnstrueif this configuration instance contains no property.protected @NotBlank com.fasterxml.jackson.core.JsonPointerpropertyToPointer(@NotBlank String key) Resolves configuration keys to JSON pointer expressions by replacing properties separator with the JSON pointer segment separator.protected voidRemoves the specified configuration properties.voidSaves the configuration properties to the specified writer.protected voidSets the value of the specified configuration property.Methods inherited from class dev.orne.config.impl.AbstractWatchableConfig
addListener, getEvents, notifyLocalChanges, 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.FileMutableConfig
save, save, save, saveMethods inherited from interface dev.orne.config.WatchableConfig
addListener, removeListener, subset
-
Constructor Details
-
JsonMutableConfigImpl
public JsonMutableConfigImpl(@NotNull @NotNull ConfigOptions options, @NotNull @NotNull MutableConfigOptions mutableOptions, @NotNull @NotNull JsonConfigOptions jsonOptions) Creates a new instance.- Parameters:
options- The configuration builder options.mutableOptions- The mutable configuration builder options.jsonOptions- The JSON based configuration builder options.
-
-
Method Details
-
getJsonObject
@NotNull protected @NotNull com.fasterxml.jackson.databind.node.ObjectNode getJsonObject()Returns the JSON object with the configuration properties.- Returns:
- The JSON object with the configuration properties.
-
getPropertySeparator
Returns the configuration nested properties separator.- Returns:
- The configuration nested properties separator.
-
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.
-
propertyToPointer
@NotBlank protected @NotBlank com.fasterxml.jackson.core.JsonPointer propertyToPointer(@NotBlank @NotBlank String key) Resolves configuration keys to JSON pointer expressions by replacing properties separator with the JSON pointer segment separator.- Parameters:
key- The configuration key.- Returns:
- The JSON pointer expression.
-
save
Saves the configuration properties to the specified writer.- Specified by:
savein interfaceFileMutableConfig- Parameters:
destination- The destination writer.- Throws:
IOException- If an I/O error occurs.
-