Module io.helidon.builder.api
Package io.helidon.builder.api
Interface Prototype.ConfiguredBuilder<BUILDER,PROTOTYPE>
- Type Parameters:
BUILDER- type of the builderPROTOTYPE- type of the prototype to be built
- All Superinterfaces:
Prototype.Builder<BUILDER,PROTOTYPE>
- Enclosing class:
Prototype
public static interface Prototype.ConfiguredBuilder<BUILDER,PROTOTYPE>
extends Prototype.Builder<BUILDER,PROTOTYPE>
Extension of
Prototype.Builder that supports configuration.
If a blueprint is marked as @Configured, build will accept configuration.-
Method Summary
Modifier and TypeMethodDescriptionUpdate builder from configuration.default <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) Discover service from configuration.default <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) Discover services from configuration.Methods inherited from interface io.helidon.builder.api.Prototype.Builder
buildPrototype, self
-
Method Details
-
config
Update builder from configuration. Any configured option that is defined on this prototype will be checked in configuration, and if it exists, it will override current value for that option on this builder. Options that do not exist in the provided config will not impact current values. The config instance is kept and may be used in builder decorator, it is not available in prototype implementation.- Parameters:
config- configuration to use- Returns:
- updated builder instance
-
discoverServices
default <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) Discover services from configuration.- 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 node- Returns:
- list of discovered services, ordered by
Weight(highest weight is first in the list)
-
discoverService
default <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) Discover service from configuration.- 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 node- Returns:
- the first service (ordered by
Weightthat is discovered, or empty optional if none is found
-