Module io.helidon.config
Package io.helidon.config
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 builderU
- type of target for watchable sources, useVoid
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 aSource
implementation.
-
-
Constructor Summary
Constructors Constructor Description AbstractSourceBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected B
changeWatcher(ChangeWatcher<U> changeWatcher)
Configure a change watcher.protected B
config(Config metaConfig)
Configure builder from meta configuration.B
optional(boolean optional)
Whether the source is optional or not.protected B
pollingStrategy(PollingStrategy pollingStrategy)
Configure a polling strategy.B
retryPolicy(Supplier<? extends RetryPolicy> policy)
Configure a retry policy to be used with this source.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.helidon.config.spi.Source.Builder
optional
-
-
-
-
Method Detail
-
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 interfaceSource.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 interfaceSource.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 asFileSystemWatcher
- 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 asClasspathConfigSource
.- Parameters:
pollingStrategy
- polling strategy to use- Returns:
- updated builder instance
-
-