Module io.helidon.config
Package io.helidon.config
Class AbstractConfigSourceBuilder<B extends AbstractConfigSourceBuilder<B,U>,U>
- java.lang.Object
-
- io.helidon.config.AbstractSourceBuilder<B,U>
-
- io.helidon.config.AbstractConfigSourceBuilder<B,U>
-
- Type Parameters:
B
- Type of the builder implementationU
- Type of a target if this builder supports change watching, useVoid
if not
- All Implemented Interfaces:
Source.Builder<B>
- Direct Known Subclasses:
ClasspathConfigSource.Builder
,DirectoryConfigSource.Builder
,EtcdConfigSourceBuilder
,FileConfigSource.Builder
,GitConfigSourceBuilder
,MapConfigSource.MapBuilder
,UrlConfigSource.Builder
public abstract class AbstractConfigSourceBuilder<B extends AbstractConfigSourceBuilder<B,U>,U> extends AbstractSourceBuilder<B,U> implements Source.Builder<B>
Common ancestor for config source builders, taking care of configurable options understood by the config module.
-
-
Constructor Summary
Constructors Constructor Description AbstractConfigSourceBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected B
config(Config metaConfig)
Configure builder from meta configuration.protected B
mediaType(String mediaType)
Media type if this is aParsableSource
and explicit media type is configured.B
mediaTypeMapping(Function<Config.Key,Optional<String>> mediaTypeMapping)
Sets a function that maps keys to media type.protected B
parser(ConfigParser parser)
A parser if this is aParsableSource
and explicit parser is configured.B
parserMapping(Function<Config.Key,Optional<ConfigParser>> parserMapping)
Sets a function that maps keys to a parser.-
Methods inherited from class io.helidon.config.AbstractSourceBuilder
changeWatcher, optional, pollingStrategy, retryPolicy
-
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, optional, retryPolicy
-
-
-
-
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.Media type and type mapping media-type Media type from loaded data is used by default for parsable config sources Explicit media type to use, such as when a file has invalid suffix, or when we need to explicitly mark the media type. media-type-mapping No media type mapping is done by default A mapping of key to a media type, allowing us to have a key that contains a sub-tree (e.g. a key that contains json data) - when we configure a mapping of the key to application/json
, the data would be expanded into config as a proper tree structure- Overrides:
config
in classAbstractSourceBuilder<B extends AbstractConfigSourceBuilder<B,U>,U>
- Parameters:
metaConfig
- meta configuration of this source- Returns:
- updated builder instance
-
mediaTypeMapping
public B mediaTypeMapping(Function<Config.Key,Optional<String>> mediaTypeMapping)
Sets a function that maps keys to media type. This supports parsing of values using aConfigParser
to expand an inlined configuration.- Parameters:
mediaTypeMapping
- a mapping function- Returns:
- a modified builder
-
parserMapping
public B parserMapping(Function<Config.Key,Optional<ConfigParser>> parserMapping)
Sets a function that maps keys to a parser. This supports parsing of specific values using a custom parser to expand an inlined configuration.- Parameters:
parserMapping
- a mapping function- Returns:
- a modified builder
-
parser
protected B parser(ConfigParser parser)
A parser if this is aParsableSource
and explicit parser is configured.- Parameters:
parser
- parser configured for this source- Returns:
- updated builder instance
-
mediaType
protected B mediaType(String mediaType)
Media type if this is aParsableSource
and explicit media type is configured.- Parameters:
mediaType
- media type configured for this source- Returns:
- updated builder instance
-
-