- java.lang.Object
-
- io.helidon.config.AbstractSource
-
- io.helidon.config.AbstractConfigSource
-
- All Implemented Interfaces:
ConfigSource
,Source
,Supplier<ConfigSource>
- Direct Known Subclasses:
ClasspathConfigSource
,DirectoryConfigSource
,EtcdConfigSource
,FileConfigSource
,GitConfigSource
,MapConfigSource
,UrlConfigSource
public abstract class AbstractConfigSource extends AbstractSource implements ConfigSource
A base implementation for config sources, that combines configuration from any type of a config source. This class does not directly implement the interfaces - this is left to the implementer of the config source. This class provides configuration methods asprotected
, so you can make them public in your implementation, to only expose methods that must be implemented.Other methods of the config source interfaces must be implemented by each source as they are data specific, such as
PollableSource.isModified(Object)
. All other methods return reasonable defaults. Config framework analyzes the config source based on interfaces it implements.- See Also:
ConfigSource
,WatchableSource
,PollableSource
,ParsableSource
-
-
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
AbstractConfigSource(AbstractConfigSourceBuilder<?,?> builder)
Use common data from the builder to setup media type, parser, media type mapping, and parser mapping on this instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Optional<String>
mediaType()
Media type if on eis configured for parsing content ofParsableSource
.protected Optional<ConfigParser>
parser()
Config parser if one is configured to use for parsing content ofParsableSource
.String
toString()
-
Methods inherited from class io.helidon.config.AbstractSource
changeWatcher, description, optional, pollingStrategy, retryPolicy, uid
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.helidon.config.spi.ConfigSource
get, init
-
Methods inherited from interface io.helidon.config.spi.Source
description, exists, optional, retryPolicy
-
-
-
-
Constructor Detail
-
AbstractConfigSource
protected AbstractConfigSource(AbstractConfigSourceBuilder<?,?> builder)
Use common data from the builder to setup media type, parser, media type mapping, and parser mapping on this instance. Additional common data is handled byAbstractSource(AbstractSourceBuilder)
.- Parameters:
builder
- builder used to set up this config source
-
-
Method Detail
-
mediaType
protected Optional<String> mediaType()
Media type if on eis configured for parsing content ofParsableSource
. If there is none configured (default), a parser is chosen based onConfigParser.Content.mediaType()
- media type detected during load of data.- Returns:
- configured media type or empty if none configured
-
parser
protected Optional<ConfigParser> parser()
Config parser if one is configured to use for parsing content ofParsableSource
. If one is not configured on a source (default), a parser is chosen based onmediaType()
.- Returns:
- a configured parser, or empty if one should be chosen from media type (or if this is not a parsable source)
-
-