Class AbstractConfig

java.lang.Object
dev.orne.config.impl.AbstractConfig
All Implemented Interfaces:
Config
Direct Known Subclasses:
AbstractMutableConfig, EnvironmentConfigImpl, SpringEnvironmentConfigImpl, SystemConfigImpl

@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 Details

  • Constructor Details

    • AbstractConfig

      protected AbstractConfig(ConfigOptions options)
      Creates a new instance.
      Parameters:
      options - The configuration builder options.
  • Method Details

    • getParent

      public @Nullable Config getParent()
      Returns the parent configuration, if any.
      Specified by:
      getParent in interface Config
      Returns:
      The parent configuration
    • isOverrideParentProperties

      public boolean isOverrideParentProperties()
      Returns true if the properties values from the parent configuration (if any) are overridden by the properties values from this instance.
      Returns:
      true if the properties values from the parent configuration are overridden by the properties values from this instance.
    • getDecoder

      protected ValueDecoder getDecoder()
      Returns the read configuration properties values decoder.
      Returns:
      The configuration properties values decoder.
    • getDecorator

      protected ValueDecorator getDecorator()
      Returns the read configuration properties values decorator.
      Returns:
      The configuration properties values decorator.
    • getResolver

      protected Optional<VariableResolver> getResolver()
      Returns the configuration properties values variable resolver.
      Returns:
      The configuration properties values variable resolver.
    • isEmpty

      public boolean isEmpty()
      Returns true if the configuration contains no property.
      Specified by:
      isEmpty in interface Config
      Returns:
      Returns true if the configuration contains no property.
    • isEmptyInt

      protected abstract boolean isEmptyInt()
      Returns true if this configuration instance contains no property.

      Parent configuration

      Returns:
      Returns true if the configuration contains no property.
      Throws:
      NonIterableConfigException - If the configuration property keys cannot be iterated.
      ConfigException - If an error occurs accessing the configuration.
    • contains

      public boolean contains(String key)
      Returns true if the property with the key passed as argument has been configured.
      Specified by:
      contains in interface Config
      Parameters:
      key - The configuration property.
      Returns:
      Returns true if the property has been configured.
    • containsInt

      protected abstract boolean containsInt(String key)
      Returns true if the property with the key passed as argument has been configured in this configuration instance.
      Parameters:
      key - The configuration property.
      Returns:
      Returns true if the property has been configured.
    • getKeys

      public Stream<String> getKeys()
      Returns the configuration property keys contained in this configuration.
      Specified by:
      getKeys in interface Config
      Returns:
      The configuration property keys.
    • getKeysInt

      protected abstract Stream<String> 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

      public @Nullable String get(String key)
      Returns the value of the configuration parameter as String.
      Specified by:
      get in interface Config
      Parameters:
      key - The configuration property
      Returns:
      The configuration parameter value as String
    • getUndecored

      public @Nullable String getUndecored(String key)
      Returns the value of the configuration parameter as String without applying any decoration or transformation.
      Specified by:
      getUndecored in interface Config
      Parameters:
      key - The configuration property
      Returns:
      The configuration parameter value as String
    • getInt

      protected abstract @Nullable String getInt(String key)
      Returns the value of the configuration property as String.
      Parameters:
      key - The configuration property.
      Returns:
      The configuration parameter value.
      Throws:
      ConfigException - If an error occurs retrieving the configuration property value.