Class Settings.Builder
- java.lang.Object
-
- org.elasticsearch.common.settings.Settings.Builder
-
- Enclosing class:
- Settings
public static class Settings.Builder extends java.lang.ObjectA builder allowing to put different settings and thenbuild()an immutable settings implementation. UseSettings.builder()in order to construct it.
-
-
Field Summary
Fields Modifier and Type Field Description static SettingsEMPTY_SETTINGS
-
Method Summary
Modifier and Type Method Description Settingsbuild()Settings.Buildercopy(java.lang.String key, java.lang.String sourceKey, Settings source)Settings.Buildercopy(java.lang.String key, Settings source)java.lang.Stringget(java.lang.String key)Returns a setting value based on the setting key.SecureSettingsgetSecureSettings()Return the current secure settings, ornullif none have been set.java.util.Set<java.lang.String>keys()Settings.BuilderloadFromPath(java.nio.file.Path path)Loads settings from a url that represents them usingSettings.fromXContent(XContentParser)Note: Loading from a path doesn't allownullvalues in the incoming xcontentSettings.BuilderloadFromSource(java.lang.String source, XContentType xContentType)Loads settings from the actual string content that represents them usingSettings.fromXContent(XContentParser)Settings.BuilderloadFromStream(java.lang.String resourceName, java.io.InputStream is, boolean acceptNullValues)Loads settings from a stream that represents them usingSettings.fromXContent(XContentParser)Settings.BuildernormalizePrefix(java.lang.String prefix)Checks that all settings in the builder start with the specified prefix.Settings.Builderput(java.lang.String setting, boolean value)Sets the setting with the provided setting key and the boolean value.Settings.Builderput(java.lang.String setting, double value)Sets the setting with the provided setting key and the double value.Settings.Builderput(java.lang.String setting, float value)Sets the setting with the provided setting key and the float value.Settings.Builderput(java.lang.String setting, int value)Sets the setting with the provided setting key and the int value.Settings.Builderput(java.lang.String setting, long value)Sets the setting with the provided setting key and the long value.Settings.Builderput(java.lang.String setting, long value, java.util.concurrent.TimeUnit timeUnit)Sets the setting with the provided setting key and the time value.Settings.Builderput(java.lang.String setting, long value, ByteSizeUnit sizeUnit)Sets the setting with the provided setting key and the size value.Settings.Builderput(java.lang.String key, java.lang.Enum<?> enumValue)Sets an enum setting with the provided setting key and enum instance.Settings.Builderput(java.lang.String key, java.lang.String value)Sets a setting with the provided setting key and value.Settings.Builderput(java.lang.String key, java.nio.file.Path path)Sets a path setting with the provided setting key and path.Settings.Builderput(java.lang.String key, org.apache.logging.log4j.Level level)Sets an level setting with the provided setting key and level instance.Settings.Builderput(java.lang.String key, org.apache.lucene.util.Version luceneVersion)Sets an lucene version setting with the provided setting key and lucene version instance.Settings.Builderput(java.lang.String key, ByteSizeValue byteSizeValue)Sets a byteSizeValue setting with the provided setting key and byteSizeValue.Settings.Builderput(java.lang.String key, TimeValue timeValue)Sets a time value setting with the provided setting key and value.Settings.Builderput(java.lang.String setting, Version version)Settings.Builderput(Settings settings)Sets all the provided settings including secure settingsSettings.Builderput(Settings settings, boolean copySecureSettings)Sets all the provided settings.Settings.BuilderputList(java.lang.String setting, java.lang.String... values)Sets the setting with the provided setting key and an array of values.Settings.BuilderputList(java.lang.String setting, java.util.List<java.lang.String> values)Sets the setting with the provided setting key and a list of values.Settings.BuilderputNull(java.lang.String key)Sets a null value for the given setting keySettings.BuilderputProperties(java.util.Map<java.lang.String,java.lang.String> esSettings, java.util.function.Function<java.lang.String,java.lang.String> keyFunction)java.lang.Stringremove(java.lang.String key)Removes the provided setting from the internal map holding the current list of settings.Settings.BuilderreplacePropertyPlaceholders()Runs across all the settings set on this builder and replaces${...}elements in each setting with another setting already set on this builder.Settings.BuildersetSecureSettings(SecureSettings secureSettings)
-
-
-
Field Detail
-
EMPTY_SETTINGS
public static final Settings EMPTY_SETTINGS
-
-
Method Detail
-
keys
public java.util.Set<java.lang.String> keys()
-
remove
public java.lang.String remove(java.lang.String key)
Removes the provided setting from the internal map holding the current list of settings.
-
get
public java.lang.String get(java.lang.String key)
Returns a setting value based on the setting key.
-
getSecureSettings
public SecureSettings getSecureSettings()
Return the current secure settings, ornullif none have been set.
-
setSecureSettings
public Settings.Builder setSecureSettings(SecureSettings secureSettings)
-
put
public Settings.Builder put(java.lang.String key, java.nio.file.Path path)
Sets a path setting with the provided setting key and path.- Parameters:
key- The setting keypath- The setting path- Returns:
- The builder
-
put
public Settings.Builder put(java.lang.String key, TimeValue timeValue)
Sets a time value setting with the provided setting key and value.- Parameters:
key- The setting keytimeValue- The setting timeValue- Returns:
- The builder
-
put
public Settings.Builder put(java.lang.String key, ByteSizeValue byteSizeValue)
Sets a byteSizeValue setting with the provided setting key and byteSizeValue.- Parameters:
key- The setting keybyteSizeValue- The setting value- Returns:
- The builder
-
put
public Settings.Builder put(java.lang.String key, java.lang.Enum<?> enumValue)
Sets an enum setting with the provided setting key and enum instance.- Parameters:
key- The setting keyenumValue- The setting value- Returns:
- The builder
-
put
public Settings.Builder put(java.lang.String key, org.apache.logging.log4j.Level level)
Sets an level setting with the provided setting key and level instance.- Parameters:
key- The setting keylevel- The setting value- Returns:
- The builder
-
put
public Settings.Builder put(java.lang.String key, org.apache.lucene.util.Version luceneVersion)
Sets an lucene version setting with the provided setting key and lucene version instance.- Parameters:
key- The setting keyluceneVersion- The setting value- Returns:
- The builder
-
put
public Settings.Builder put(java.lang.String key, java.lang.String value)
Sets a setting with the provided setting key and value.- Parameters:
key- The setting keyvalue- The setting value- Returns:
- The builder
-
copy
public Settings.Builder copy(java.lang.String key, Settings source)
-
copy
public Settings.Builder copy(java.lang.String key, java.lang.String sourceKey, Settings source)
-
putNull
public Settings.Builder putNull(java.lang.String key)
Sets a null value for the given setting key
-
put
public Settings.Builder put(java.lang.String setting, boolean value)
Sets the setting with the provided setting key and the boolean value.- Parameters:
setting- The setting keyvalue- The boolean value- Returns:
- The builder
-
put
public Settings.Builder put(java.lang.String setting, int value)
Sets the setting with the provided setting key and the int value.- Parameters:
setting- The setting keyvalue- The int value- Returns:
- The builder
-
put
public Settings.Builder put(java.lang.String setting, Version version)
-
put
public Settings.Builder put(java.lang.String setting, long value)
Sets the setting with the provided setting key and the long value.- Parameters:
setting- The setting keyvalue- The long value- Returns:
- The builder
-
put
public Settings.Builder put(java.lang.String setting, float value)
Sets the setting with the provided setting key and the float value.- Parameters:
setting- The setting keyvalue- The float value- Returns:
- The builder
-
put
public Settings.Builder put(java.lang.String setting, double value)
Sets the setting with the provided setting key and the double value.- Parameters:
setting- The setting keyvalue- The double value- Returns:
- The builder
-
put
public Settings.Builder put(java.lang.String setting, long value, java.util.concurrent.TimeUnit timeUnit)
Sets the setting with the provided setting key and the time value.- Parameters:
setting- The setting keyvalue- The time value- Returns:
- The builder
-
put
public Settings.Builder put(java.lang.String setting, long value, ByteSizeUnit sizeUnit)
Sets the setting with the provided setting key and the size value.- Parameters:
setting- The setting keyvalue- The size value- Returns:
- The builder
-
putList
public Settings.Builder putList(java.lang.String setting, java.lang.String... values)
Sets the setting with the provided setting key and an array of values.- Parameters:
setting- The setting keyvalues- The values- Returns:
- The builder
-
putList
public Settings.Builder putList(java.lang.String setting, java.util.List<java.lang.String> values)
Sets the setting with the provided setting key and a list of values.- Parameters:
setting- The setting keyvalues- The values- Returns:
- The builder
-
put
public Settings.Builder put(Settings settings)
Sets all the provided settings including secure settings
-
put
public Settings.Builder put(Settings settings, boolean copySecureSettings)
Sets all the provided settings.- Parameters:
settings- the settings to setcopySecureSettings- iftrueall settings including secure settings are copied.
-
loadFromSource
public Settings.Builder loadFromSource(java.lang.String source, XContentType xContentType)
Loads settings from the actual string content that represents them usingSettings.fromXContent(XContentParser)
-
loadFromPath
public Settings.Builder loadFromPath(java.nio.file.Path path) throws java.io.IOException
Loads settings from a url that represents them usingSettings.fromXContent(XContentParser)Note: Loading from a path doesn't allownullvalues in the incoming xcontent- Throws:
java.io.IOException
-
loadFromStream
public Settings.Builder loadFromStream(java.lang.String resourceName, java.io.InputStream is, boolean acceptNullValues) throws java.io.IOException
Loads settings from a stream that represents them usingSettings.fromXContent(XContentParser)- Throws:
java.io.IOException
-
putProperties
public Settings.Builder putProperties(java.util.Map<java.lang.String,java.lang.String> esSettings, java.util.function.Function<java.lang.String,java.lang.String> keyFunction)
-
replacePropertyPlaceholders
public Settings.Builder replacePropertyPlaceholders()
Runs across all the settings set on this builder and replaces${...}elements in each setting with another setting already set on this builder.
-
normalizePrefix
public Settings.Builder normalizePrefix(java.lang.String prefix)
Checks that all settings in the builder start with the specified prefix. If a setting doesn't start with the prefix, the builder appends the prefix to such setting.
-
build
public Settings build()
-
-