java.lang.Object
io.helidon.common.config.ConfigBuilderSupport
Methods used from generated code in builders when
Prototype.Configured
is used.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Extension ofPrototype.Builder
that supports configuration. -
Method Summary
Modifier and TypeMethodDescriptionstatic <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.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 fromServiceRegistry
for builder options annotated withOption.Provider
, if the blueprint is annotated withPrototype.RegistrySupport
.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.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 fromServiceRegistry
for builder options annotated withOption.Provider
, if the blueprint is annotated withPrototype.RegistrySupport
.
-
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 fromServiceRegistry
for builder options annotated withOption.Provider
, if the blueprint is annotated withPrototype.RegistrySupport
.- Type Parameters:
T
- type of the service- Parameters:
config
- configuration of the optionconfigKey
- configuration key associated with this optionserviceRegistry
- service registry instanceproviderType
- type of the service provider (contract)configType
- type of the configurationallFromRegistry
- whether to use all services from the registryexistingValues
- 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 fromServiceRegistry
for builder options annotated withOption.Provider
, if the blueprint is annotated withPrototype.RegistrySupport
.- Type Parameters:
T
- type of the service- Parameters:
config
- configuration of the optionconfigKey
- configuration key associated with this optionserviceRegistry
- service registry instanceproviderType
- type of the service provider (contract)configType
- type of the configurationdiscoverServices
- whether to discover services from registryexistingValue
- 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 serviceT
- type of the configured service provider that creates instances of S- Parameters:
config
- configuration located at the parent node of the service providersconfigKey
- 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 typeproviderType
- type of the service provider interfaceconfigType
- type of the configured serviceallFromServiceLoader
- whether all services from service loader should be used, or only the ones with configured nodeexistingInstances
- 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 serviceT
- type of the configured service provider that creates instances of S- Parameters:
config
- configuration located at the parent node of the service providersconfigKey
- 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 typeproviderType
- type of the service provider interfaceconfigType
- type of the configured serviceallFromServiceLoader
- whether all services from service loader should be used, or only the ones with configured nodeexistingValue
- 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
-