Class AbstractConfig

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 Details

  • Constructor Details

    • AbstractConfig

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

    • getParent

      public 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

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

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

      @NotNull protected @NotNull 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(@NotBlank @NotBlank 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(@NotBlank @NotBlank 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

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

      @NotNull protected abstract @NotNull 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 String get(@NotBlank @NotBlank 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 String getUndecored(@NotBlank @NotBlank 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 String getInt(@NotBlank @NotBlank 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.