Class HelidonServiceLoader.Builder<T>

    • Method Detail

      • build

        public HelidonServiceLoader<T> build()
        Description copied from interface: Builder
        Build the instance from this builder.
        Specified by:
        build in interface Builder<T>
        Returns:
        instance of the built type
      • useSystemExcludes

        public HelidonServiceLoader.Builder<T> useSystemExcludes​(boolean useSysPropExclude)
        When configured to use system excludes, system property "io.helidon.common.serviceloader.exclude" is used to get the comma separated list of service implementations to exclude them from the loaded list.

        This defaults to true.

        Parameters:
        useSysPropExclude - whether to use a system property to exclude service implementations
        Returns:
        updated builder instance
      • useSystemServiceLoader

        public HelidonServiceLoader.Builder<T> useSystemServiceLoader​(boolean useServiceLoader)
        When configured to use Java Service loader, then the result is a combination of all service implementations loaded from the Java Service loader and those added by addService(Object) or addService(Object, int). When set to false the Java Service loader is ignored.

        This defaults to true.

        Parameters:
        useServiceLoader - whether to use the Java Service loader
        Returns:
        updated builder instance
      • replaceImplementations

        public HelidonServiceLoader.Builder<T> replaceImplementations​(boolean replace)
        When configured to replace implementations, then a service implementation configured through addService(Object) will replace the same implementation loaded from the Java Service loader (compared by fully qualified class name).

        This defaults to true.

        Parameters:
        replace - whether to replace service instances loaded by java service loader with the ones provided through builder methods
        Returns:
        updated builder instance
      • addService

        public HelidonServiceLoader.Builder<T> addService​(T service)
        Add a custom service implementation to the list of services.
        Parameters:
        service - a new service instance
        Returns:
        updated builder instance
      • addService

        public HelidonServiceLoader.Builder<T> addService​(T service,
                                                          int priority)
        Add a custom service implementation to the list of services with a custom priority.
        Parameters:
        service - a new service instance
        priority - priority to use when ordering service instances
        Returns:
        updated builder instance
      • addExcludedClass

        public HelidonServiceLoader.Builder<T> addExcludedClass​(Class<? extends T> excluded)
        Add an excluded implementation class - if such a service implementation is configured (either through Java Service loader or through addService(Object)), it would be ignored.
        Parameters:
        excluded - excluded implementation class
        Returns:
        updated builder instance
      • addExcludedClassName

        public HelidonServiceLoader.Builder<T> addExcludedClassName​(String excludeName)
        Add an excluded implementation class - if such a service implementation is configured (either through Java Service loader or through addService(Object)), it would be ignored.
        Parameters:
        excludeName - excluded implementation class name
        Returns:
        updated builder instance