public static final class ConfigSources.MapBuilder extends Object implements Builder<ConfigSource>
ConfigSource based on a Map containing
config entries.
The caller constructs a MapBuilder with either a Map or a
Properties object. The builder uses the Map entries or
Properties name/value pairs to create config entries:
Map key or Properties property name is the
fully-qualified dotted-name format key for the corresponding
Config node.
Map value or Properties property value is the
corresponding value of the corresponding Config node.
Map or Properties object
contains duplicate keys then the Source.load() on the
returned ConfigSource will fail. The caller can invoke
lax() to relax this restriction, in which case the
load operation will log collision warnings but continue.
For example, the following properties collide:
app.port = 8080
app = app-name
The MapConfigSource returned by build() and get()
works with an immutable copy of original map; it does
not support
ConfigSource mutability.
| Modifier and Type | Method and Description |
|---|---|
ConfigSource |
build()
Builds new instance of
MapConfigSource from the Map
or Properties passed to a constructor. |
ConfigSource |
get() |
ConfigSources.MapBuilder |
lax()
Switches off strict mode.
|
public ConfigSources.MapBuilder lax()
In lax mode Source.load() does not fail if config keys
collide; it logs warnings and continues.
public ConfigSource build()
MapConfigSource from the Map
or Properties passed to a constructor.build in interface Builder<ConfigSource>MapConfigSource based on the specified Map or Propertiespublic ConfigSource get()
get in interface Builder<ConfigSource>get in interface Supplier<ConfigSource>Copyright © 2018, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.