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 aConfigSourcebased on aMapcontaining config entries.The caller constructs a
MapBuilderwith either aMapor aPropertiesobject. The builder uses theMapentries orPropertiesname/value pairs to create config entries:- Each
Mapkey orPropertiesproperty name is the fully-qualified dotted-name format key for the correspondingConfignode. - Each
Mapvalue orPropertiesproperty value is the corresponding value of the correspondingConfignode.
MaporPropertiesobject contains duplicate keys then theSource.load()on the returnedConfigSourcewill fail. The caller can invokelax()to relax this restriction, in which case theloadoperation will log collision warnings but continue.For example, the following properties collide:
app.port = 8080 app = app-nameThe
MapConfigSourcereturned 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 ConfigSourcebuild()Builds new instance ofMapConfigSourcefrom theMaporPropertiespassed to a constructor.ConfigSourceget()ConfigSources.MapBuilderlax()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 ofMapConfigSourcefrom theMaporPropertiespassed to a constructor.- Specified by:
buildin interfaceBuilder<ConfigSource>- Returns:
MapConfigSourcebased on the specifiedMaporProperties
-
get
public ConfigSource get()
- Specified by:
getin interfaceBuilder<ConfigSource>- Specified by:
getin interfaceSupplier<ConfigSource>
-
-