Interface Prototype.ConfiguredBuilder<BUILDER,PROTOTYPE>

Type Parameters:
BUILDER - type of the builder
PROTOTYPE - 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 Details

    • config

      BUILDER config(Config 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 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
      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 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
      Returns:
      the first service (ordered by Weight that is discovered, or empty optional if none is found