java.lang.Object
dev.orne.config.impl.AbstractConfig
- All Implemented Interfaces:
Config
- Direct Known Subclasses:
AbstractMutableConfig,CommonsConfigImpl,EnvironmentConfigImpl,JsonConfigImpl,PreferencesConfigImpl,PropertiesConfigImpl,SpringEnvironmentConfigImpl,SystemConfigImpl,XmlConfigImpl
@API(status=INTERNAL,
since="1.0")
public abstract class AbstractConfig
extends Object
implements Config
Base abstract implementation of configuration properties provider.
- Since:
- 1.0
- Version:
- 1.0, 2025-04
- Author:
- (w) Iker Hernaez
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringError message for blank property keys. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractConfig(@NotNull ConfigOptions options) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturnstrueif the property with the key passed as argument has been configured.protected abstract booleancontainsInt(@NotBlank String key) Returnstrueif the property with the key passed as argument has been configured in this configuration instance.Returns the value of the configuration parameter asString.protected @NotNull ValueDecoderReturns the read configuration properties values decoder.protected @NotNull ValueDecoratorReturns the read configuration properties values decorator.protected abstract StringReturns the value of the configuration property asString.getKeys()Returns the configuration property keys contained in this configuration.Returns the configuration property keys contained in this configuration instance .Returns the parent configuration, if any.protected @NotNull Optional<VariableResolver>Returns the configuration properties values variable resolver.getUndecored(@NotBlank String key) Returns the value of the configuration parameter asStringwithout applying any decoration or transformation.booleanisEmpty()Returnstrueif the configuration contains no property.protected abstract booleanReturnstrueif this configuration instance contains no property.booleanReturnstrueif the properties values from the parent configuration (if any) are overridden by the properties values from this instance.Methods 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
-
Field Details
-
KEY_BLANK_ERR
Error message for blank property keys.- See Also:
-
-
Constructor Details
-
AbstractConfig
Creates a new instance.- Parameters:
options- The configuration builder options.
-
-
Method Details
-
getParent
Returns the parent configuration, if any. -
isOverrideParentProperties
public boolean isOverrideParentProperties()Returnstrueif the properties values from the parent configuration (if any) are overridden by the properties values from this instance.- Returns:
trueif the properties values from the parent configuration are overridden by the properties values from this instance.
-
getDecoder
Returns the read configuration properties values decoder.- Returns:
- The configuration properties values decoder.
-
getDecorator
Returns the read configuration properties values decorator.- Returns:
- The configuration properties values decorator.
-
getResolver
Returns the configuration properties values variable resolver.- Returns:
- The configuration properties values variable resolver.
-
isEmpty
public boolean isEmpty()Returnstrueif the configuration contains no property. -
isEmptyInt
protected abstract boolean isEmptyInt()Returnstrueif this configuration instance contains no property.Parent configuration
- Returns:
- Returns
trueif the configuration contains no property. - Throws:
NonIterableConfigException- If the configuration property keys cannot be iterated.ConfigException- If an error occurs accessing the configuration.
-
contains
Returnstrueif the property with the key passed as argument has been configured. -
containsInt
Returnstrueif the property with the key passed as argument has been configured in this configuration instance.- Parameters:
key- The configuration property.- Returns:
- Returns
trueif the property has been configured.
-
getKeys
Returns the configuration property keys contained in this configuration. -
getKeysInt
Returns the configuration property keys contained in this configuration instance .- Returns:
- The configuration property keys.
- Throws:
NonIterableConfigException- If the configuration property keys cannot be iterated.ConfigException- If an error occurs accessing the configuration.
-
get
Returns the value of the configuration parameter asString. -
getUndecored
Returns the value of the configuration parameter asStringwithout applying any decoration or transformation.- Specified by:
getUndecoredin interfaceConfig- Parameters:
key- The configuration property- Returns:
- The configuration parameter value as
String
-
getInt
Returns the value of the configuration property asString.- Parameters:
key- The configuration property.- Returns:
- The configuration parameter value.
- Throws:
ConfigException- If an error occurs retrieving the configuration property value.
-