Class BuilderSupport

java.lang.Object
io.helidon.builder.api.BuilderSupport

public final class BuilderSupport extends Object
Static methods used from generated prototypes and builders.

This only contains methods that can be used without additional dependencies (i.e. ServiceLoader based).

  • Method Details

    • discoverServices

      public static <C> List<C> discoverServices(Class<C> contract, boolean discoverServices, List<C> existingInstances)
      Discover services from Java ServiceLoader. This method will only add instances of classes that are not already part of existingInstances.
      Type Parameters:
      C - type of the contract to use
      Parameters:
      contract - service contract (or provider interface as used in ServiceLoader)
      discoverServices - whether to discover services from service loader, if set to false, service loader is ignored
      existingInstances - instances already configured on the builder
      Returns:
      a list of new instances to add to the builder
    • discoverService

      public static <C> Optional<C> discoverService(Class<C> contract, boolean discoverServices, Optional<C> existingInstance)
      Discover a service from ServiceLoader. This method will only query the service loader if the existingInstance is empty.
      Type Parameters:
      C - type of the contract
      Parameters:
      contract - service contract (or provider interface as used in ServiceLoader)
      discoverServices - whether to discover services from service loader, if set to false, service loader is ignored
      existingInstance - an instance configured on the builder
      Returns:
      value to be used by the builder (either the existing instance, an instance from ServiceLoader, or empty if none found