Module org.github.gestalt.core
Package org.github.gestalt.config.source
Class MapConfigSourceBuilder
- java.lang.Object
-
- org.github.gestalt.config.builder.SourceBuilder<MapConfigSourceBuilder,MapConfigSource>
-
- org.github.gestalt.config.source.MapConfigSourceBuilder
-
public final class MapConfigSourceBuilder extends SourceBuilder<MapConfigSourceBuilder,MapConfigSource>
ConfigSourceBuilder for the Map Config Source.Allows a user to provide a custom config source as a map. would take the same form as a property file with a key that can be tokenized and a value. db.port = 1234 db.password = password dp.user = notroot
-
-
Field Summary
-
Fields inherited from class org.github.gestalt.config.builder.SourceBuilder
configReloadStrategies, source, tags
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MapConfigSourceBuilderaddCustomConfig(java.lang.String path, java.lang.String value)Add a new configuration with a path and a value.ConfigSourcePackagebuild()Build the ConfigSourcePackage with the config source, tags and any reload strategies.static MapConfigSourceBuilderbuilder()Static function to create the builder.java.util.Map<java.lang.String,java.lang.String>getCustomConfig()Get the map that backs the config source.MapConfigSourceBuildersetCustomConfig(java.util.Map<java.lang.String,java.lang.String> customConfig)Set the map that backs the config source.-
Methods inherited from class org.github.gestalt.config.builder.SourceBuilder
addConfigReloadStrategy, addTag, buildPackage, getConfigReloadStrategies, getTags, self, setTags
-
-
-
-
Method Detail
-
builder
public static MapConfigSourceBuilder builder()
Static function to create the builder.- Returns:
- the builder
-
getCustomConfig
public java.util.Map<java.lang.String,java.lang.String> getCustomConfig()
Get the map that backs the config source.- Returns:
- the map that backs the config source.
-
setCustomConfig
public MapConfigSourceBuilder setCustomConfig(java.util.Map<java.lang.String,java.lang.String> customConfig)
Set the map that backs the config source.- Parameters:
customConfig- the map that backs the config source.- Returns:
- the builder
-
addCustomConfig
public MapConfigSourceBuilder addCustomConfig(java.lang.String path, java.lang.String value)
Add a new configuration with a path and a value.- Parameters:
path- the path for the configurationvalue- the value for the configuration.- Returns:
- the builder
-
build
public ConfigSourcePackage build() throws GestaltException
Description copied from class:SourceBuilderBuild the ConfigSourcePackage with the config source, tags and any reload strategies.- Specified by:
buildin classSourceBuilder<MapConfigSourceBuilder,MapConfigSource>- Returns:
- the ConfigSourcePackage with the config source, tags and any reload strategies.
- Throws:
GestaltException- exceptions if any of the required properties are not set.
-
-