- java.lang.Object
-
- io.helidon.config.AbstractSourceBuilder<B,U>
-
- io.helidon.config.AbstractConfigSourceBuilder<ClasspathConfigSource.Builder,Void>
-
- io.helidon.config.ClasspathConfigSource.Builder
-
- All Implemented Interfaces:
Builder<ClasspathConfigSource>,ParsableSource.Builder<ClasspathConfigSource.Builder>,Source.Builder<ClasspathConfigSource.Builder>,Supplier<ClasspathConfigSource>
- Enclosing class:
- ClasspathConfigSource
public static final class ClasspathConfigSource.Builder extends AbstractConfigSourceBuilder<ClasspathConfigSource.Builder,Void> implements ParsableSource.Builder<ClasspathConfigSource.Builder>, Builder<ClasspathConfigSource>
Classpath ConfigSource Builder.It allows to configure following properties:
resource- configuration resource name;optional- is existence of configuration resource mandatory (by default) or isoptional?media-type- configuration content media type to be used to look for appropriateConfigParser;parser- or directly setConfigParserinstance to be used to parse the source;
If the ConfigSource is
mandatoryand aresourcedoes not exist thenParsableSource.load()throwsConfigException.If
media-typenot set it tries to guess it from resource extension.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClasspathConfigSourcebuild()Builds new instance of Classpath ConfigSource.ClasspathConfigSource.Builderconfig(Config metaConfig)Configure builder from meta configuration.ClasspathConfigSource.BuildermediaType(String mediaType)Media type if this is aParsableSourceand explicit media type is configured.ClasspathConfigSource.Builderparser(ConfigParser parser)A parser if this is aParsableSourceand explicit parser is configured.ClasspathConfigSource.Builderresource(String resource)Configure the classpath resource to load the configuration from.-
Methods inherited from class io.helidon.config.AbstractConfigSourceBuilder
mediaTypeMapping, parserMapping
-
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
-
build
public ClasspathConfigSource build()
Builds new instance of Classpath ConfigSource.If
media-typenot set it tries to guess it from resource extension before parsing.- Specified by:
buildin interfaceBuilder<ClasspathConfigSource>- Returns:
- new instance of Classpath ConfigSource.
-
config
public ClasspathConfigSource.Builder config(Config metaConfig)
Configure builder from meta configuration.The following configuration options are supported:
Optional configuration parameters key default value description optional falseConfigure to trueif 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 propertiessub 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 propertiessub 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 propertiessub 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 structureresource- the classpath resource to load
- Overrides:
configin classAbstractConfigSourceBuilder<ClasspathConfigSource.Builder,Void>- Parameters:
metaConfig- configuration properties used to configure a builder instance.- Returns:
- updated builder instance
-
parser
public ClasspathConfigSource.Builder parser(ConfigParser parser)
Description copied from class:AbstractConfigSourceBuilderA parser if this is aParsableSourceand explicit parser is configured.- Specified by:
parserin interfaceParsableSource.Builder<ClasspathConfigSource.Builder>- Overrides:
parserin classAbstractConfigSourceBuilder<ClasspathConfigSource.Builder,Void>- Parameters:
parser- parser configured for this source- Returns:
- updated builder instance
-
mediaType
public ClasspathConfigSource.Builder mediaType(String mediaType)
Description copied from class:AbstractConfigSourceBuilderMedia type if this is aParsableSourceand explicit media type is configured.- Specified by:
mediaTypein interfaceParsableSource.Builder<ClasspathConfigSource.Builder>- Overrides:
mediaTypein classAbstractConfigSourceBuilder<ClasspathConfigSource.Builder,Void>- Parameters:
mediaType- media type configured for this source- Returns:
- updated builder instance
-
resource
public ClasspathConfigSource.Builder resource(String resource)
Configure the classpath resource to load the configuration from.- Parameters:
resource- resource on classpath- Returns:
- updated builder instance
-
-