Interface ConfigBuilder<S extends ConfigBuilder<S>>

Type Parameters:
S - The concrete type of the builder.
All Known Subinterfaces:
CommonsConfigBuilder, CommonsMutableConfigBuilder, EnvironmentConfigBuilder, JsonConfigBaseBuilder<S>, JsonConfigBuilder, JsonMutableConfigBuilder, MutableCapableConfigBuilder<S,M>, MutableConfigBuilder<S>, PreferencesConfigBuilder, PreferencesMutableConfigBuilder, PropertiesConfigBaseBuilder<S>, PropertiesConfigBuilder, PropertiesMutableConfigBuilder, SpringEnvironmentConfigBuilder, SystemConfigBuilder, XmlConfigBaseBuilder<S>, XmlConfigBuilder, XmlMutableConfigBuilder, YamlConfigBaseBuilder<S>, YamlConfigBuilder, YamlMutableConfigBuilder
All Known Implementing Classes:
AbstractConfigBuilderImpl, AbstractMutableConfigBuilderImpl, CommonsConfigBuilderImpl, CommonsMutableConfigBuilderImpl, EnvironmentConfigBuilderImpl, JsonConfigBuilderImpl, JsonMutableConfigBuilderImpl, PreferencesConfigBuilderImpl, PreferencesMutableConfigBuilderImpl, PropertiesConfigBuilderImpl, PropertiesMutableConfigBuilderImpl, SpringEnvironmentConfigBuilderImpl, SystemConfigBuilderImpl, XmlConfigBuilderImpl, XmlMutableConfigBuilderImpl, YamlConfigBuilderImpl, YamlMutableConfigBuilderImpl

@API(status=STABLE, since="1.0") public interface ConfigBuilder<S extends ConfigBuilder<S>>
Configuration builder.
Since:
1.0
Version:
1.0, 2025-05
Author:
(w) Iker Hernaez
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    default <T extends Config>
    T
    as(Class<T> configType)
    Creates the configuration instance as an instance of the specified configuration type.
    Creates the configuration instance.
    withDecoder(@Nullable ValueDecoder encoder)
    Sets the configuration properties values decoder.
    withDecorator(@Nullable ValueDecorator decorator)
    Sets the configuration properties values decorator.
    Sets the configuration properties values cryptography transformations provider.
    Sets whether the configuration properties values from the parent configuration (if any) must be overridden by the properties values from this configuration.
    withParent(@Nullable Config parent)
    Sets the parent configuration.
    default S
    Sets the parent configuration.
    Enables configuration property values variable resolution.
  • Method Details

    • withParent

      S withParent(@Nullable Config parent)
      Sets the parent configuration.
      Parameters:
      parent - The parent configuration.
      Returns:
      This instance, for method chaining.
    • withParent

      default S withParent(ConfigBuilder<?> parent)
      Sets the parent configuration.

      This is a shortcut for withParent(parent.build()) that allows less verbose configuration hierarchies building.

      Parameters:
      parent - The parent configuration.
      Returns:
      This instance, for method chaining.
    • withOverrideParentProperties

      S withOverrideParentProperties()
      Sets whether the configuration properties values from the parent configuration (if any) must be overridden by the properties values from this configuration.

      By default, parent configuration properties values are not overridden. Thus, if a property is defined both in current configuration and in the parent configuration, the value from the parent configuration will be returned.

      Returns:
      This instance, for method chaining.
    • withEncryption

      S withEncryption(@Nullable ConfigCryptoProvider provider)
      Sets the configuration properties values cryptography transformations provider.
      Parameters:
      provider - The cryptography transformations provider.
      Returns:
      This instance, for method chaining.
    • withDecoder

      S withDecoder(@Nullable ValueDecoder encoder)
      Sets the configuration properties values decoder. Applied to property values contained in the builded configuration instance (not to the parent configuration properties, if any).
      Parameters:
      encoder - The configuration properties values decoder.
      Returns:
      This instance, for method chaining.
    • withVariableResolution

      S withVariableResolution()
      Enables configuration property values variable resolution.
      Returns:
      This instance, for method chaining.
    • withDecorator

      S withDecorator(@Nullable ValueDecorator decorator)
      Sets the configuration properties values decorator. Applied to property values returned by the builded configuration instance (whatever its source).
      Parameters:
      decorator - The configuration properties values decorator.
      Returns:
      This instance, for method chaining.
    • build

      Config build()
      Creates the configuration instance.
      Returns:
      The configuration instance.
    • as

      default <T extends Config> T as(Class<T> configType)
      Creates the configuration instance as an instance of the specified configuration type.

      This is a shortcut for Config.as(build(), configType).

      Type Parameters:
      T - The configuration sub-type.
      Parameters:
      configType - The configuration sub-type.
      Returns:
      The configuration instance.
      See Also: