Class ConfigBuilderSupport

java.lang.Object
io.helidon.common.config.ConfigBuilderSupport

public final class ConfigBuilderSupport extends Object
Methods used from generated code in builders when Prototype.Configured is used.
  • Method Details

    • discoverServices

      public static <T extends NamedService> List<T> discoverServices(Config config, String configKey, Optional<ServiceRegistry> serviceRegistry, Class<? extends ConfiguredProvider<T>> providerType, Class<T> configType, boolean allFromRegistry, List<T> existingValues)
      Used to discover services from ServiceRegistry for builder options annotated with Option.Provider, if the blueprint is annotated with Prototype.RegistrySupport.
      Type Parameters:
      T - type of the service
      Parameters:
      config - configuration of the option
      configKey - configuration key associated with this option
      serviceRegistry - service registry instance
      providerType - type of the service provider (contract)
      configType - type of the configuration
      allFromRegistry - whether to use all services from the registry
      existingValues - existing values that was explicitly configured by the user
      Returns:
      instances from the user augmented with instances from the registry
    • discoverService

      public static <T extends NamedService> Optional<T> discoverService(Config config, String configKey, Optional<ServiceRegistry> serviceRegistry, Class<? extends ConfiguredProvider<T>> providerType, Class<T> configType, boolean discoverServices, Optional<T> existingValue)
      Used to discover service from ServiceRegistry for builder options annotated with Option.Provider, if the blueprint is annotated with Prototype.RegistrySupport.
      Type Parameters:
      T - type of the service
      Parameters:
      config - configuration of the option
      configKey - configuration key associated with this option
      serviceRegistry - service registry instance
      providerType - type of the service provider (contract)
      configType - type of the configuration
      discoverServices - whether to discover services from registry
      existingValue - existing value that was explicitly configured by the user
      Returns:
      an instance, if available in the registry, or if provided by the user (user's value wins)
    • discoverServices

      public static <S extends NamedService, T extends ConfiguredProvider<S>> List<S> discoverServices(Config config, String configKey, HelidonServiceLoader<T> serviceLoader, Class<T> providerType, Class<S> configType, boolean allFromServiceLoader, List<S> existingInstances)
      Discover services from configuration. If already configured instances already contain a service of the same type and name that would be added from configuration, the configuration would be ignored (e.g. the user must make a choice whether to configure, or set using an API).
      Type Parameters:
      S - type of the expected service
      T - type of the configured service provider that creates instances of S
      Parameters:
      config - configuration located at the parent node of the service providers
      configKey - configuration key of the provider list (either a list node, or object, where each child is one service)
      serviceLoader - helidon service loader for the expected type
      providerType - type of the service provider interface
      configType - type of the configured service
      allFromServiceLoader - whether all services from service loader should be used, or only the ones with configured node
      existingInstances - already configured instances
      Returns:
      list of discovered services, ordered by Weight (highest weight is first in the list)
    • discoverService

      public static <S extends NamedService, T extends ConfiguredProvider<S>> Optional<S> discoverService(Config config, String configKey, HelidonServiceLoader<T> serviceLoader, Class<T> providerType, Class<S> configType, boolean allFromServiceLoader, Optional<S> existingValue)
      Discover service from configuration. If an instance is already configured using a builder, it will not be discovered from configuration (e.g. the user must make a choice whether to configure, or set using API).
      Type Parameters:
      S - type of the expected service
      T - type of the configured service provider that creates instances of S
      Parameters:
      config - configuration located at the parent node of the service providers
      configKey - configuration key of the provider list (either a list node, or object, where each child is one service - this method requires * zero to one configured services)
      serviceLoader - helidon service loader for the expected type
      providerType - type of the service provider interface
      configType - type of the configured service
      allFromServiceLoader - whether all services from service loader should be used, or only the ones with configured node
      existingValue - value already configured, if the name is same as discovered from configuration
      Returns:
      the first service (ordered by Weight that is discovered, or empty optional if none is found