public static class Settings.Builder
extends java.lang.Object
build()
an immutable
settings implementation. Use Settings.builder()
in order to
construct it.Modifier and Type | Field and Description |
---|---|
static Settings |
EMPTY_SETTINGS |
Modifier and Type | Method and Description |
---|---|
Settings |
build()
|
Settings.Builder |
extendArray(java.lang.String setting,
java.lang.String... values)
Sets the setting as an array of values, but keeps existing elements for the key.
|
java.lang.String |
get(java.lang.String key)
Returns a setting value based on the setting key.
|
SecureSettings |
getSecureSettings()
Return the current secure settings, or
null if none have been set. |
java.util.Map<java.lang.String,java.lang.String> |
internalMap() |
Settings.Builder |
loadFromPath(java.nio.file.Path path)
Loads settings from a url that represents them using the
SettingsLoaderFactory.loaderFromResource(String) . |
Settings.Builder |
loadFromSource(java.lang.String source)
Deprecated.
use
loadFromSource(String, XContentType) to avoid content type detection |
Settings.Builder |
loadFromSource(java.lang.String source,
XContentType xContentType)
Loads settings from the actual string content that represents them using the
SettingsLoaderFactory.loaderFromXContentType(XContentType) method to obtain a loader |
Settings.Builder |
loadFromStream(java.lang.String resourceName,
java.io.InputStream is)
Loads settings from a stream that represents them using the
SettingsLoaderFactory.loaderFromResource(String) . |
Settings.Builder |
normalizePrefix(java.lang.String prefix)
Checks that all settings in the builder start with the specified prefix.
|
Settings.Builder |
put(java.util.Dictionary<java.lang.Object,java.lang.Object> properties)
Sets all the provided settings.
|
Settings.Builder |
put(java.util.Map<java.lang.String,java.lang.String> settings)
Sets all the provided settings.
|
Settings.Builder |
put(java.lang.Object... settings)
Puts tuples of key value pairs of settings.
|
Settings.Builder |
put(Settings settings)
Sets all the provided settings.
|
Settings.Builder |
put(java.lang.String setting,
boolean value)
Sets the setting with the provided setting key and the boolean value.
|
Settings.Builder |
put(java.lang.String key,
java.lang.Class clazz)
Sets a setting with the provided setting key and class as value.
|
Settings.Builder |
put(java.lang.String setting,
double value)
Sets the setting with the provided setting key and the double value.
|
Settings.Builder |
put(java.lang.String setting,
float value)
Sets the setting with the provided setting key and the float value.
|
Settings.Builder |
put(java.lang.String setting,
int value)
Sets the setting with the provided setting key and the int value.
|
Settings.Builder |
put(java.lang.String setting,
long value)
Sets the setting with the provided setting key and the long value.
|
Settings.Builder |
put(java.lang.String setting,
long value,
ByteSizeUnit sizeUnit)
Sets the setting with the provided setting key and the size value.
|
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.
|
Settings.Builder |
put(java.lang.String key,
java.lang.String value)
Sets a setting with the provided setting key and value.
|
Settings.Builder |
put(java.lang.String settingPrefix,
java.lang.String groupName,
java.lang.String[] settings,
java.lang.String[] values)
Sets the setting group.
|
Settings.Builder |
put(java.lang.String setting,
Version version) |
Settings.Builder |
putArray(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.Builder |
putArray(java.lang.String setting,
java.lang.String... values)
Sets the setting with the provided setting key and an array of values.
|
Settings.Builder |
putNull(java.lang.String key) |
Settings.Builder |
putProperties(java.util.Map<java.lang.String,java.lang.String> esSettings,
java.util.function.Function<java.lang.String,java.lang.String> keyFunction) |
java.lang.String |
remove(java.lang.String key)
Removes the provided setting from the internal map holding the current list of settings.
|
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.
|
Settings.Builder |
setSecureSettings(SecureSettings secureSettings) |
public static final Settings EMPTY_SETTINGS
public java.util.Map<java.lang.String,java.lang.String> internalMap()
public java.lang.String remove(java.lang.String key)
public java.lang.String get(java.lang.String key)
public SecureSettings getSecureSettings()
null
if none have been set.public Settings.Builder setSecureSettings(SecureSettings secureSettings)
public Settings.Builder put(java.lang.Object... settings)
public Settings.Builder put(java.lang.String key, java.lang.String value)
key
- The setting keyvalue
- The setting valuepublic Settings.Builder putNull(java.lang.String key)
public Settings.Builder put(java.lang.String key, java.lang.Class clazz)
key
- The setting keyclazz
- The setting class valuepublic Settings.Builder put(java.lang.String setting, boolean value)
setting
- The setting keyvalue
- The boolean valuepublic Settings.Builder put(java.lang.String setting, int value)
setting
- The setting keyvalue
- The int valuepublic Settings.Builder put(java.lang.String setting, Version version)
public Settings.Builder put(java.lang.String setting, long value)
setting
- The setting keyvalue
- The long valuepublic Settings.Builder put(java.lang.String setting, float value)
setting
- The setting keyvalue
- The float valuepublic Settings.Builder put(java.lang.String setting, double value)
setting
- The setting keyvalue
- The double valuepublic Settings.Builder put(java.lang.String setting, long value, java.util.concurrent.TimeUnit timeUnit)
setting
- The setting keyvalue
- The time valuepublic Settings.Builder put(java.lang.String setting, long value, ByteSizeUnit sizeUnit)
setting
- The setting keyvalue
- The size valuepublic Settings.Builder putArray(java.lang.String setting, java.lang.String... values)
setting
- The setting keyvalues
- The valuespublic Settings.Builder putArray(java.lang.String setting, java.util.List<java.lang.String> values)
setting
- The setting keyvalues
- The valuespublic Settings.Builder extendArray(java.lang.String setting, java.lang.String... values)
public Settings.Builder put(java.lang.String settingPrefix, java.lang.String groupName, java.lang.String[] settings, java.lang.String[] values) throws SettingsException
SettingsException
public Settings.Builder put(Settings settings)
public Settings.Builder put(java.util.Map<java.lang.String,java.lang.String> settings)
public Settings.Builder put(java.util.Dictionary<java.lang.Object,java.lang.Object> properties)
@Deprecated public Settings.Builder loadFromSource(java.lang.String source)
loadFromSource(String, XContentType)
to avoid content type detectionSettingsLoaderFactory.loaderFromSource(String)
.public Settings.Builder loadFromSource(java.lang.String source, XContentType xContentType)
SettingsLoaderFactory.loaderFromXContentType(XContentType)
method to obtain a loaderpublic Settings.Builder loadFromPath(java.nio.file.Path path) throws java.io.IOException
SettingsLoaderFactory.loaderFromResource(String)
.java.io.IOException
public Settings.Builder loadFromStream(java.lang.String resourceName, java.io.InputStream is) throws java.io.IOException
SettingsLoaderFactory.loaderFromResource(String)
.java.io.IOException
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)
public Settings.Builder replacePropertyPlaceholders()
public Settings.Builder normalizePrefix(java.lang.String prefix)
public Settings build()