Class Settings
org.elasticsearch.common.settings.Settings
- All Implemented Interfaces:
org.elasticsearch.common.xcontent.ToXContent
,org.elasticsearch.common.xcontent.ToXContentFragment
public final class Settings
extends
implements org.elasticsearch.common.xcontent.ToXContentFragment
An immutable settings implementation.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A builder allowing to put different settings and thenSettings.Builder.build()
an immutable settings implementation.Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params
-
Field Summary
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
Method Summary
Modifier and TypeMethodDescriptionstatic Settings.Builder
builder()
Returns a builder to be used in order to build settings.boolean
o)
<> predicate)
Returns a new settings object that contains all setting of the current one filtered by the given settings key predicate.static Settings
fromXContent(org.elasticsearch.common.xcontent.XContentParser parser)
Parsers the generated xcontent fromtoXContent(XContentBuilder, Params)
into a new Settings object.setting)
Returns the setting value associated with the setting key.setting, defaultValue)
Returns the setting value associated with the setting key.setting, defaultValue)
Returns the setting value (as boolean) associated with the setting key.setting, ByteSizeValue defaultValue)
Returns the setting value (as size) associated with the setting key.setting, defaultValue)
Returns the setting value (as double) associated with the setting key.setting, defaultValue)
Returns the setting value (as float) associated with the setting key.<,Settings>
Returns group settings for the given setting prefix.setting, defaultValue)
Returns the setting value (as int) associated with the setting key.<>
key)
The values associated with a setting key as an immutable list.<>
key, <> defaultValue)
The values associated with a setting key as an immutable list.<>
key, <> defaultValue, commaDelimited)
The values associated with a setting key as an immutable list.setting, defaultValue)
Returns the setting value (as long) associated with the setting key.setting, defaultValue)
Returns the setting value (as size) associated with the setting key.setting)
Returns the settings mapped to the given setting name.org.elasticsearch.core.TimeValue
setting, org.elasticsearch.core.TimeValue defaultValue)
Returns the setting value (as time) associated with the setting key.setting, Version defaultVersion)
Returns a parsed version.prefix)
A settings that are filtered (and key is removed) with the specified prefix.<,Settings>
settingPrefix)
Returns group settings for the given setting prefix.<,Settings>
settingPrefix, boolean ignoreNonGrouped)
Returns group settings for the given setting prefix.int
hashCode()
boolean
key)
Returnstrue
iff the given key has a value in this settings objectboolean
isEmpty()
Returnstrue
if this settings object contains no settings<>
keySet()
Returns the fully qualified setting names contained in this settings object.<>
names()
static Settings
int
size()
Returns the number of settings in this settings object.toDelimitedString(char delimiter)
Returns the settings as delimited string.toString()
org.elasticsearch.common.xcontent.XContentBuilder
toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
static void
writeSettingsToStream(Settings settings, StreamOutput out)
Methods inherited from class java.lang.
, , , , , , ,
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Field Details
-
EMPTY
-
FORMAT_PARAMS
public static final <> FORMAT_PARAMS
-
-
Method Details
-
getByPrefix
public prefix)A settings that are filtered (and key is removed) with the specified prefix. -
filter
public <> predicate)Returns a new settings object that contains all setting of the current one filtered by the given settings key predicate. -
getAsSettings
public setting)Returns the settings mapped to the given setting name. -
get
public get( setting)Returns the setting value associated with the setting key.- Parameters:
setting
- The setting key- Returns:
- The setting value,
null
if it does not exists.
-
get
public get( setting, defaultValue)Returns the setting value associated with the setting key. If it does not exists, returns the default value provided. -
getAsFloat
public getAsFloat( setting, defaultValue)Returns the setting value (as float) associated with the setting key. If it does not exists, returns the default value provided. -
getAsDouble
public getAsDouble( setting, defaultValue)Returns the setting value (as double) associated with the setting key. If it does not exists, returns the default value provided. -
getAsInt
public getAsInt( setting, defaultValue)Returns the setting value (as int) associated with the setting key. If it does not exists, returns the default value provided. -
getAsLong
public getAsLong( setting, defaultValue)Returns the setting value (as long) associated with the setting key. If it does not exists, returns the default value provided. -
hasValue
public boolean hasValue( key)Returnstrue
iff the given key has a value in this settings object -
getAsBoolean
public getAsBoolean( setting, defaultValue)Returns the setting value (as boolean) associated with the setting key. If it does not exists, returns the default value provided. -
getAsTime
public org.elasticsearch.core.TimeValue getAsTime( setting, org.elasticsearch.core.TimeValue defaultValue)Returns the setting value (as time) associated with the setting key. If it does not exists, returns the default value provided. -
getAsBytesSize
Returns the setting value (as size) associated with the setting key. If it does not exists, returns the default value provided.- Throws:
SettingsException
-
getAsMemory
Returns the setting value (as size) associated with the setting key. Provided values can either be absolute values (interpreted as a number of bytes), byte sizes (eg. 1mb) or percentage of the heap size (eg. 12%). If it does not exists, parses the default value provided.- Throws:
SettingsException
-
getAsList
The values associated with a setting key as an immutable list.It will also automatically load a comma separated list under the settingPrefix and merge with the numbered format.
- Parameters:
key
- The setting key to load the list by- Returns:
- The setting list values
- Throws:
SettingsException
-
getAsList
The values associated with a setting key as an immutable list.If commaDelimited is true, it will automatically load a comma separated list under the settingPrefix and merge with the numbered format.
- Parameters:
key
- The setting key to load the list by- Returns:
- The setting list values
- Throws:
SettingsException
-
getAsList
The values associated with a setting key as an immutable list.It will also automatically load a comma separated list under the settingPrefix and merge with the numbered format.
- Parameters:
key
- The setting key to load the list bydefaultValue
- The default value to use if no value is specifiedcommaDelimited
- Whether to try to parse a string as a comma-delimited value- Returns:
- The setting list values
- Throws:
SettingsException
-
getGroups
Returns group settings for the given setting prefix.- Throws:
SettingsException
-
getGroups
Returns group settings for the given setting prefix.- Throws:
SettingsException
-
getAsGroups
Returns group settings for the given setting prefix.- Throws:
SettingsException
-
getAsVersion
Returns a parsed version.- Throws:
SettingsException
-
names
public <> names()- Returns:
- The direct keys of this settings
-
toDelimitedString
public toDelimitedString(char delimiter)Returns the settings as delimited string. -
equals
public boolean equals( o)- Overrides:
in class
-
hashCode
public int hashCode()- Overrides:
in class
-
readSettingsFromStream
- Throws:
-
writeSettingsToStream
- Throws:
-
builder
Returns a builder to be used in order to build settings. -
toXContent
public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws- Specified by:
toXContent
in interfaceorg.elasticsearch.common.xcontent.ToXContent
- Throws:
-
fromXContent
public static Settings fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throwsParsers the generated xcontent fromtoXContent(XContentBuilder, Params)
into a new Settings object. Note this method requires the parser to either be positioned on a null token or onXContentParser.Token.START_OBJECT
.- Throws:
-
isEmpty
public boolean isEmpty()Returnstrue
if this settings object contains no settings- Returns:
true
if this settings object contains no settings
-
size
public int size()Returns the number of settings in this settings object. -
keySet
public <> keySet()Returns the fully qualified setting names contained in this settings object. -
toString
public toString()- Overrides:
in class
-