public final class Settings extends Object implements ToXContent
Modifier and Type | Class and Description |
---|---|
static class |
Settings.Builder
A builder allowing to put different settings and then
Settings.Builder.build() an immutable
settings implementation. |
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Modifier and Type | Field and Description |
---|---|
static Settings |
EMPTY |
static String |
SETTINGS_REQUIRE_UNITS
Name of the setting to use to disable required units for byte size, time settings.
|
EMPTY_PARAMS
Modifier and Type | Method and Description |
---|---|
static Settings.Builder |
builder() |
boolean |
equals(Object o) |
String |
get(String setting)
Returns the setting value associated with the setting key.
|
String |
get(String[] settings)
Returns the setting value associated with the first setting key.
|
String |
get(String[] settings,
String defaultValue)
Returns the setting value associated with the first setting key, if none exists,
returns the default value provided.
|
String |
get(String setting,
String defaultValue)
Returns the setting value associated with the setting key.
|
String[] |
getAsArray(String settingPrefix)
The values associated with a setting prefix as an array.
|
String[] |
getAsArray(String settingPrefix,
String[] defaultArray)
The values associated with a setting prefix as an array.
|
String[] |
getAsArray(String settingPrefix,
String[] defaultArray,
Boolean commaDelimited)
The values associated with a setting prefix as an array.
|
Boolean |
getAsBoolean(String[] settings,
Boolean defaultValue)
Returns the setting value (as boolean) associated with the setting key.
|
Boolean |
getAsBoolean(String setting,
Boolean defaultValue)
Returns the setting value (as boolean) associated with the setting key.
|
ByteSizeValue |
getAsBytesSize(String[] settings,
ByteSizeValue defaultValue)
Returns the setting value (as size) associated with the setting key.
|
ByteSizeValue |
getAsBytesSize(String setting,
ByteSizeValue defaultValue)
Returns the setting value (as size) associated with the setting key.
|
Double |
getAsDouble(String[] settings,
Double defaultValue)
Returns the setting value (as double) associated with teh first setting key, if none
exists, returns the default value provided.
|
Double |
getAsDouble(String setting,
Double defaultValue)
Returns the setting value (as double) associated with the setting key.
|
Float |
getAsFloat(String[] settings,
Float defaultValue)
Returns the setting value (as float) associated with teh first setting key, if none
exists, returns the default value provided.
|
Float |
getAsFloat(String setting,
Float defaultValue)
Returns the setting value (as float) associated with the setting key.
|
Integer |
getAsInt(String[] settings,
Integer defaultValue)
Returns the setting value (as int) associated with the first setting key.
|
Integer |
getAsInt(String setting,
Integer defaultValue)
Returns the setting value (as int) associated with the setting key.
|
Long |
getAsLong(String[] settings,
Long defaultValue)
Returns the setting value (as long) associated with the setting key.
|
Long |
getAsLong(String setting,
Long defaultValue)
Returns the setting value (as long) associated with the setting key.
|
Map<String,String> |
getAsMap()
The settings as a flat
Map . |
ByteSizeValue |
getAsMemory(String[] settings,
String defaultValue)
Returns the setting value (as size) associated with the setting key.
|
ByteSizeValue |
getAsMemory(String setting,
String defaultValue)
Returns the setting value (as size) associated with the setting key.
|
RatioValue |
getAsRatio(String[] settings,
String defaultValue)
Returns the setting value (as a RatioValue) associated with the setting key.
|
RatioValue |
getAsRatio(String setting,
String defaultValue)
Returns the setting value (as a RatioValue) associated with the setting key.
|
Settings |
getAsSettings(String setting)
Returns the settings mapped to the given setting name.
|
SizeValue |
getAsSize(String[] settings,
SizeValue defaultValue)
Returns the setting value (as size) associated with the setting key.
|
SizeValue |
getAsSize(String setting,
SizeValue defaultValue)
Returns the setting value (as size) associated with the setting key.
|
Map<String,Object> |
getAsStructuredMap()
The settings as a structured
Map . |
TimeValue |
getAsTime(String[] settings,
TimeValue defaultValue)
Returns the setting value (as time) associated with the setting key.
|
TimeValue |
getAsTime(String setting,
TimeValue defaultValue)
Returns the setting value (as time) associated with the setting key.
|
Version |
getAsVersion(String setting,
Version defaultVersion)
Returns a parsed version.
|
Settings |
getByPrefix(String prefix)
A settings that are filtered (and key is removed) with the specified prefix.
|
Map<String,Settings> |
getGroups(String settingPrefix)
Returns group settings for the given setting prefix.
|
Map<String,Settings> |
getGroups(String settingPrefix,
boolean ignoreNonGrouped)
Returns group settings for the given setting prefix.
|
static boolean |
getSettingsRequireUnits() |
int |
hashCode() |
Set<String> |
names() |
static Settings |
readSettingsFromStream(StreamInput in) |
static void |
setSettingsRequireUnits(boolean v) |
static Settings.Builder |
settingsBuilder()
Returns a builder to be used in order to build settings.
|
String |
toDelimitedString(char delimiter)
Returns the settings as delimited string.
|
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params) |
static void |
writeSettingsToStream(Settings settings,
StreamOutput out) |
public static final Settings EMPTY
public static final String SETTINGS_REQUIRE_UNITS
public static void setSettingsRequireUnits(boolean v)
public static boolean getSettingsRequireUnits()
public Map<String,String> getAsMap()
Map
.public Settings getByPrefix(String prefix)
public Settings getAsSettings(String setting)
public String get(String setting)
setting
- The setting keypublic String get(String[] settings)
public String get(String setting, String defaultValue)
public String get(String[] settings, String defaultValue)
public Float getAsFloat(String setting, Float defaultValue)
public Float getAsFloat(String[] settings, Float defaultValue) throws SettingsException
SettingsException
public Double getAsDouble(String setting, Double defaultValue)
public Double getAsDouble(String[] settings, Double defaultValue)
public Integer getAsInt(String setting, Integer defaultValue)
public Integer getAsInt(String[] settings, Integer defaultValue)
public Long getAsLong(String setting, Long defaultValue)
public Long getAsLong(String[] settings, Long defaultValue)
public Boolean getAsBoolean(String setting, Boolean defaultValue)
public Boolean getAsBoolean(String[] settings, Boolean defaultValue)
public TimeValue getAsTime(String setting, TimeValue defaultValue)
public TimeValue getAsTime(String[] settings, TimeValue defaultValue)
public ByteSizeValue getAsBytesSize(String setting, ByteSizeValue defaultValue) throws SettingsException
SettingsException
public ByteSizeValue getAsBytesSize(String[] settings, ByteSizeValue defaultValue) throws SettingsException
SettingsException
public ByteSizeValue getAsMemory(String setting, String defaultValue) throws SettingsException
SettingsException
public ByteSizeValue getAsMemory(String[] settings, String defaultValue) throws SettingsException
SettingsException
public RatioValue getAsRatio(String setting, String defaultValue) throws SettingsException
SettingsException
public RatioValue getAsRatio(String[] settings, String defaultValue) throws SettingsException
SettingsException
public SizeValue getAsSize(String setting, SizeValue defaultValue) throws SettingsException
SettingsException
public SizeValue getAsSize(String[] settings, SizeValue defaultValue) throws SettingsException
SettingsException
public String[] getAsArray(String settingPrefix) throws SettingsException
It will also automatically load a comma separated list under the settingPrefix and merge with the numbered format.
settingPrefix
- The setting prefix to load the array bySettingsException
public String[] getAsArray(String settingPrefix, String[] defaultArray) throws SettingsException
If commaDelimited is true, it will automatically load a comma separated list under the settingPrefix and merge with the numbered format.
settingPrefix
- The setting prefix to load the array bySettingsException
public String[] getAsArray(String settingPrefix, String[] defaultArray, Boolean commaDelimited) throws SettingsException
It will also automatically load a comma separated list under the settingPrefix and merge with the numbered format.
settingPrefix
- The setting prefix to load the array bydefaultArray
- The default array to use if no value is specifiedcommaDelimited
- Whether to try to parse a string as a comma-delimited valueSettingsException
public Map<String,Settings> getGroups(String settingPrefix) throws SettingsException
SettingsException
public Map<String,Settings> getGroups(String settingPrefix, boolean ignoreNonGrouped) throws SettingsException
SettingsException
public Version getAsVersion(String setting, Version defaultVersion) throws SettingsException
SettingsException
public String toDelimitedString(char delimiter)
public static Settings readSettingsFromStream(StreamInput in) throws IOException
IOException
public static void writeSettingsToStream(Settings settings, StreamOutput out) throws IOException
IOException
public static Settings.Builder builder()
public static Settings.Builder settingsBuilder()
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
toXContent
in interface ToXContent
IOException
Copyright © 2009–2016. All rights reserved.