Module org.github.gestalt.core
Package org.github.gestalt.config.source
Class StringConfigSourceBuilder
- java.lang.Object
-
- org.github.gestalt.config.builder.SourceBuilder<StringConfigSourceBuilder,StringConfigSource>
-
- org.github.gestalt.config.source.StringConfigSourceBuilder
-
public final class StringConfigSourceBuilder extends SourceBuilder<StringConfigSourceBuilder,StringConfigSource>
ConfigSourceBuilder for the String Config Source.Load a config source from a String. The string must be in the format provided, so if a property file it would be db.port = 1234 db.password = password dp.user = notroot
If the format is json the string would be { db { "port" = 1234 "password" = "password" "user" = "notroot" }. }
A format for the data in the string must also be provided.
-
-
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 ConfigSourcePackagebuild()Build the ConfigSourcePackage with the config source, tags and any reload strategies.static StringConfigSourceBuilderbuilder()Static function to create the builder.java.lang.StringgetConfig()Get the string based config source.java.lang.StringgetFormat()Get the format the String Based Config source represents.StringConfigSourceBuildersetConfig(java.lang.String config)Set the string based config source.StringConfigSourceBuildersetFormat(java.lang.String format)Set the format the String Based Config source represents.-
Methods inherited from class org.github.gestalt.config.builder.SourceBuilder
addConfigReloadStrategy, addTag, buildPackage, getConfigReloadStrategies, getTags, self, setTags
-
-
-
-
Method Detail
-
builder
public static StringConfigSourceBuilder builder()
Static function to create the builder.- Returns:
- the builder
-
getConfig
public java.lang.String getConfig()
Get the string based config source.- Returns:
- the string based config source
-
setConfig
public StringConfigSourceBuilder setConfig(java.lang.String config)
Set the string based config source.- Parameters:
config- the string based config source.- Returns:
- the builder
-
getFormat
public java.lang.String getFormat()
Get the format the String Based Config source represents.- Returns:
- the format the String Based Config source represents.
-
setFormat
public StringConfigSourceBuilder setFormat(java.lang.String format)
Set the format the String Based Config source represents.- Parameters:
format- the format the String Based Config source represents.- 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<StringConfigSourceBuilder,StringConfigSource>- Returns:
- the ConfigSourcePackage with the config source, tags and any reload strategies.
- Throws:
GestaltException- exceptions if any of the required properties are not set.
-
-