Class ConfigurationLoaderSupport<A,B,C extends ConfigurationLoaderSupport<A,B,C>>

java.lang.Object
io.inverno.mod.configuration.AbstractConfigurationLoader<A,C>
io.inverno.mod.configuration.ConfigurationLoaderSupport<A,B,C>
Type Parameters:
A - the configuration type
B - the configurator type
C - the configuration loader type
All Implemented Interfaces:
ConfigurationLoader<A,C>
Direct Known Subclasses:
BootConfigurationLoader, BootNetClientConfigurationLoader, BootNetServerConfigurationLoader, HttpClientConfigurationLoader, HttpServerConfigurationLoader, JOSEConfigurationLoader, LDAPClientConfigurationLoader, LettuceRedisClientConfigurationLoader, VertxSqlClientConfigurationLoader, WebServerConfigurationLoader

public abstract class ConfigurationLoaderSupport<A,B,C extends ConfigurationLoaderSupport<A,B,C>> extends AbstractConfigurationLoader<A,C>

Base implementation for generated configuration loader.

ConfigurationLoaderSupport implementations are generated by the Inverno configuration compiler and loads configuration properties explicitly invoking generated configurator and builder to eventually load the configuration.

This configuration loader works as follows:

If a configuration source is specified:

  1. Loads a list of properties from the configuration source
  2. Maps the resulting query results to a configurer whose role is to inject the appropriate property values in a configurator specific to the configuration to load
  3. Invokes a configuration creator which uses the previous configurator to create the configuration

If no configuration is specified, fallback to a default configuration supplier to create the configuration.

Since:
1.0
Author:
Jeremy Kuhn
See Also:
  • Constructor Details

    • ConfigurationLoaderSupport

      public ConfigurationLoaderSupport(String[] properties, Function<List<? extends ConfigurationQueryResult>,Consumer<B>> resultsToConfigurer, Function<Consumer<B>,A> configurationCreator, Supplier<A> defaultConfigurationSupplier)

      Creates a configuration loader that loads the specified list of properties and uses the specified results to configurer mapper and configuration creator function to create the configuration object.

      Parameters:
      properties - a list of property names to load
      resultsToConfigurer - a mapper function that maps the configuration query results to a configurer
      configurationCreator - a configuration creator
      defaultConfigurationSupplier - a default configuration supplier
  • Method Details

    • withConfigurer

      public C withConfigurer(Consumer<B> configurer)

      Sets a configurer that will override the configurer supplied when creating the loader when loading the configuration.

      Parameters:
      configurer - a configurer
      Returns:
      the configuration loader
    • load

      public Mono<A> load()
      Description copied from interface: ConfigurationLoader

      Loads the configuration from the configuration source with the specified parameters.

      Returns:
      a mono emitting the resulting configuration object