Package io.helidon.config
Class ConfigSources.MapBuilder
- java.lang.Object
-
- io.helidon.config.ConfigSources.MapBuilder
-
- All Implemented Interfaces:
Builder<ConfigSource>
,Supplier<ConfigSource>
- Enclosing class:
- ConfigSources
public static final class ConfigSources.MapBuilder extends Object implements Builder<ConfigSource>
Builder of aConfigSource
based on aMap
containing config entries.The caller constructs a
MapBuilder
with either aMap
or aProperties
object. The builder uses theMap
entries orProperties
name/value pairs to create config entries:- Each
Map
key orProperties
property name is the fully-qualified dotted-name format key for the correspondingConfig
node. - Each
Map
value orProperties
property value is the corresponding value of the correspondingConfig
node.
Map
orProperties
object contains duplicate keys then theSource.load()
on the returnedConfigSource
will fail. The caller can invokelax()
to relax this restriction, in which case theload
operation will log collision warnings but continue.For example, the following properties collide:
app.port = 8080 app = app-name
The
MapConfigSource
returned bybuild()
andget()
works with an immutable copy of original map; it does not supportConfigSource mutability
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigSource
build()
Builds new instance ofMapConfigSource
from theMap
orProperties
passed to a constructor.ConfigSource
get()
ConfigSources.MapBuilder
lax()
Switches off strict mode.
-
-
-
Method Detail
-
lax
public ConfigSources.MapBuilder lax()
Switches off strict mode.In lax mode
Source.load()
does not fail if config keys collide; it logs warnings and continues.- Returns:
- updated builder
-
build
public ConfigSource build()
Builds new instance ofMapConfigSource
from theMap
orProperties
passed to a constructor.- Specified by:
build
in interfaceBuilder<ConfigSource>
- Returns:
MapConfigSource
based on the specifiedMap
orProperties
-
get
public ConfigSource get()
- Specified by:
get
in interfaceBuilder<ConfigSource>
- Specified by:
get
in interfaceSupplier<ConfigSource>
-
-