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>, 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(@NotNull Class<T> configType)
    Creates the configuration instance as an instance of the specified configuration type.
    @NotNull Config
    Creates the configuration instance.
    Sets the configuration properties values decoder.
    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.
    default S
    withParent(@NotNull ConfigBuilder<?> parent)
    Sets the parent configuration.
    Sets the parent configuration.
    Enables configuration property values variable resolution.
  • Method Details

    • withParent

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

      @NotNull default S withParent(@NotNull @NotNull 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

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

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

      @NotNull S withDecoder(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

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

      @NotNull S withDecorator(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

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

      @NotNull default <T extends Config> T as(@NotNull @NotNull 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: