- java.lang.Object
-
- io.helidon.config.AbstractSource
-
- All Implemented Interfaces:
Source
- Direct Known Subclasses:
AbstractConfigSource
,ClasspathOverrideSource
,FileOverrideSource
,UrlOverrideSource
public class AbstractSource extends Object implements Source
Source options as a super set of all possible combinations of source implementation. When used as a base class, together withAbstractSourceBuilder
, you can set up any source type.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.helidon.config.spi.Source
Source.Builder<B extends Source.Builder<B>>
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractSource(AbstractSourceBuilder<?,?> builder)
A new instance configured from the provided builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Optional<ChangeWatcher<Object>>
changeWatcher()
A change watcher of this source, if it implementsWatchableSource
and has one configured.String
description()
Short, human-readable summary referring to the underlying source.boolean
optional()
Whether this source is optional.protected Optional<PollingStrategy>
pollingStrategy()
A polling strategy of this source, if it implementsPollableSource
and has one configured.Optional<RetryPolicy>
retryPolicy()
Retry policy configured on this config source.protected String
uid()
Returns universal id of source to be used to constructdescription()
.
-
-
-
Constructor Detail
-
AbstractSource
protected AbstractSource(AbstractSourceBuilder<?,?> builder)
A new instance configured from the provided builder. The builder is used to set the following:optional()
- for any source, whether the content must be present, or is optionalretryPolicy()
- for any source, policy used to retry attempts at reading the contentpollingStrategy()
- forPollableSource
, the polling strategy (if any)changeWatcher()
- forWatchableSource
, the change watcher (if any)
- Parameters:
builder
- builder used to read the configuration options
-
-
Method Detail
-
retryPolicy
public Optional<RetryPolicy> retryPolicy()
Description copied from interface:Source
Retry policy configured on this config source.- Specified by:
retryPolicy
in interfaceSource
- Returns:
- configured retry policy
-
optional
public boolean optional()
Description copied from interface:Source
Whether this source is optional.
-
pollingStrategy
protected Optional<PollingStrategy> pollingStrategy()
A polling strategy of this source, if it implementsPollableSource
and has one configured.- Returns:
- polling strategy if any configured
-
changeWatcher
protected Optional<ChangeWatcher<Object>> changeWatcher()
A change watcher of this source, if it implementsWatchableSource
and has one configured.- Returns:
- change watcher if any configured
-
uid
protected String uid()
Returns universal id of source to be used to constructdescription()
.- Returns:
- universal id of source
-
description
public String description()
Description copied from interface:Source
Short, human-readable summary referring to the underlying source.For example, a file path or a URL or any other information that helps the user recognize the underlying origin of the data this
Source
provides.Default is the implementation class simple name with any
"Source"
suffix removed.- Specified by:
description
in interfaceSource
- Returns:
- description of the source
-
-