Class AbstractSourceBuilder<B extends AbstractSourceBuilder<B,U>,U>

java.lang.Object
io.helidon.config.AbstractSourceBuilder<B,U>
Type Parameters:
B - type of implementation class of the builder
U - type of target for watchable sources, use Void if not supported
All Implemented Interfaces:
Source.Builder<B>
Direct Known Subclasses:
AbstractConfigSourceBuilder, ClasspathOverrideSource.Builder, FileOverrideSource.Builder, UrlOverrideSource.Builder

public abstract class AbstractSourceBuilder<B extends AbstractSourceBuilder<B,U>,U> extends Object implements Source.Builder<B>
Base class for common builder methods of a Source implementation.
  • Constructor Details

    • AbstractSourceBuilder

      protected AbstractSourceBuilder()
      No side effects.
  • Method Details

    • config

      protected B config(Config metaConfig)
      Configure builder from meta configuration.

      The following configuration options are supported:

      Optional configuration parameters
      key default value description
      optional false Configure to true if this source should not fail configuration setup when underlying data is missing.
      polling-strategy No polling strategy is added by default Meta configuration of a polling strategy to be used with this source, add configuration to properties sub node.
      change-watcher No change watcher is added by default Meta configuration of a change watcher to be used with this source, add configuration to properties sub node.
      retry-policy No retry policy is added by default Meta configuration of a retry policy to be used to load this source, add configuration to properties sub node.
      Parameters:
      metaConfig - meta configuration of this source
      Returns:
      updated builder instance
    • retryPolicy

      public B retryPolicy(Supplier<? extends RetryPolicy> policy)
      Description copied from interface: Source.Builder
      Configure a retry policy to be used with this source. If none is configured, the source is invoked directly with no retries.
      Specified by:
      retryPolicy in interface Source.Builder<B extends AbstractSourceBuilder<B,U>>
      Parameters:
      policy - retry policy to use
      Returns:
      updated builder instance
    • optional

      public B optional(boolean optional)
      Description copied from interface: Source.Builder
      Whether the source is optional or not. When configured to be optional, missing underlying data do not cause an exception to be raised.
      Specified by:
      optional in interface Source.Builder<B extends AbstractSourceBuilder<B,U>>
      Parameters:
      optional - true when this source should be optional
      Returns:
      updated builder instance
    • changeWatcher

      protected B changeWatcher(ChangeWatcher<U> changeWatcher)
      Configure a change watcher. This method must be exposed by builders of sources that change watching (WatchableSource). The type of the change watcher must match the type of the target of this source.
      Parameters:
      changeWatcher - change watcher to use, such as FileSystemWatcher
      Returns:
      updated builder instance
    • pollingStrategy

      protected B pollingStrategy(PollingStrategy pollingStrategy)
      Configure a polling strategy. This method must be exposed by builders of sources that support polling. If you see this method as being protected in your builder, the source has removed support for polling, such as ClasspathConfigSource.
      Parameters:
      pollingStrategy - polling strategy to use
      Returns:
      updated builder instance