public class ImmutableSettings extends Object implements Settings
Settings.| Modifier and Type | Class and Description |
|---|---|
static class |
ImmutableSettings.Builder
A builder allowing to put different settings and then
ImmutableSettings.Builder.build() an immutable
settings implementation. |
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params| Modifier and Type | Field and Description |
|---|---|
static Settings |
EMPTY |
static String |
FLAT_SETTINGS_KEY |
EMPTY_PARAMS| Modifier and Type | Method and Description |
|---|---|
static ImmutableSettings.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.
|
<T> Class<? extends T> |
getAsClass(String setting,
Class<? extends T> defaultClazz)
Returns the setting value (as a class) associated with the setting key.
|
<T> Class<? extends T> |
getAsClass(String setting,
Class<? extends T> defaultClazz,
String prefixPackage,
String suffixClassName)
Returns the setting value (as a class) 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.
|
com.google.common.collect.ImmutableMap<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.
|
ClassLoader |
getClassLoader()
The class loader associated with this settings, or
Classes.getDefaultClassLoader()
if not set. |
ClassLoader |
getClassLoaderIfSet()
The class loader associated with this settings, but only if explicitly set, otherwise null.
|
Settings |
getComponentSettings(Class component)
Component settings for a specific component.
|
Settings |
getComponentSettings(String prefix,
Class component)
Component settings for a specific component.
|
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.
|
int |
hashCode() |
Set<String> |
names() |
static Settings |
readSettingsFromStream(StreamInput in) |
static ImmutableSettings.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 FLAT_SETTINGS_KEY
public ClassLoader getClassLoader()
SettingsClasses.getDefaultClassLoader()
if not set.getClassLoader in interface Settingspublic ClassLoader getClassLoaderIfSet()
SettingsgetClassLoaderIfSet in interface Settingspublic com.google.common.collect.ImmutableMap<String,String> getAsMap()
SettingsMap.public Map<String,Object> getAsStructuredMap()
SettingsMap.getAsStructuredMap in interface Settingspublic Settings getComponentSettings(Class component)
SettingsgetComponentSettings in interface Settingspublic Settings getComponentSettings(String prefix, Class component)
SettingsgetComponentSettings in interface Settingspublic Settings getByPrefix(String prefix)
SettingsgetByPrefix in interface Settingspublic Settings getAsSettings(String setting)
SettingsgetAsSettings in interface Settingspublic String get(String setting)
Settingspublic String get(String[] settings)
Settingspublic String get(String setting, String defaultValue)
Settingspublic String get(String[] settings, String defaultValue)
Settingspublic Float getAsFloat(String setting, Float defaultValue)
SettingsgetAsFloat in interface Settingspublic Float getAsFloat(String[] settings, Float defaultValue) throws SettingsException
SettingsgetAsFloat in interface SettingsSettingsExceptionpublic Double getAsDouble(String setting, Double defaultValue)
SettingsgetAsDouble in interface Settingspublic Double getAsDouble(String[] settings, Double defaultValue)
SettingsgetAsDouble in interface Settingspublic Integer getAsInt(String setting, Integer defaultValue)
Settingspublic Integer getAsInt(String[] settings, Integer defaultValue)
Settingspublic Long getAsLong(String setting, Long defaultValue)
Settingspublic Long getAsLong(String[] settings, Long defaultValue)
Settingspublic Boolean getAsBoolean(String setting, Boolean defaultValue)
SettingsgetAsBoolean in interface Settingspublic Boolean getAsBoolean(String[] settings, Boolean defaultValue)
SettingsgetAsBoolean in interface Settingspublic TimeValue getAsTime(String setting, TimeValue defaultValue)
Settingspublic TimeValue getAsTime(String[] settings, TimeValue defaultValue)
Settingspublic ByteSizeValue getAsBytesSize(String setting, ByteSizeValue defaultValue) throws SettingsException
SettingsgetAsBytesSize in interface SettingsSettingsExceptionpublic ByteSizeValue getAsBytesSize(String[] settings, ByteSizeValue defaultValue) throws SettingsException
SettingsgetAsBytesSize in interface SettingsSettingsExceptionpublic ByteSizeValue getAsMemory(String setting, String defaultValue) throws SettingsException
SettingsgetAsMemory in interface SettingsSettingsExceptionpublic ByteSizeValue getAsMemory(String[] settings, String defaultValue) throws SettingsException
SettingsgetAsMemory in interface SettingsSettingsExceptionpublic RatioValue getAsRatio(String setting, String defaultValue) throws SettingsException
SettingsgetAsRatio in interface SettingsSettingsExceptionpublic RatioValue getAsRatio(String[] settings, String defaultValue) throws SettingsException
SettingsgetAsRatio in interface SettingsSettingsExceptionpublic SizeValue getAsSize(String setting, SizeValue defaultValue) throws SettingsException
SettingsgetAsSize in interface SettingsSettingsExceptionpublic SizeValue getAsSize(String[] settings, SizeValue defaultValue) throws SettingsException
SettingsgetAsSize in interface SettingsSettingsExceptionpublic <T> Class<? extends T> getAsClass(String setting, Class<? extends T> defaultClazz) throws NoClassSettingsException
SettingsgetAsClass in interface SettingsT - The type of the classsetting - The setting keydefaultClazz - The class to return if no value is associated with the settingNoClassSettingsException - Failure to load a classpublic <T> Class<? extends T> getAsClass(String setting, Class<? extends T> defaultClazz, String prefixPackage, String suffixClassName) throws NoClassSettingsException
SettingsgetAsClass in interface SettingsT - The type of the classsetting - The setting keydefaultClazz - The class to return if no value is associated with the settingprefixPackage - The prefix package to prefix the value with if failing to load the class as issuffixClassName - The suffix class name to prefix the value with if failing to load the class as isNoClassSettingsException - Failure to load the classpublic String[] getAsArray(String settingPrefix) throws SettingsException
SettingsIt will also automatically load a comma separated list under the settingPrefix and merge with the numbered format.
getAsArray in interface SettingssettingPrefix - The setting prefix to load the array bySettingsExceptionpublic String[] getAsArray(String settingPrefix, String[] defaultArray) throws SettingsException
SettingsIf commaDelimited is true, it will automatically load a comma separated list under the settingPrefix and merge with the numbered format.
getAsArray in interface SettingssettingPrefix - The setting prefix to load the array bySettingsExceptionpublic String[] getAsArray(String settingPrefix, String[] defaultArray, Boolean commaDelimited) throws SettingsException
SettingsIt will also automatically load a comma separated list under the settingPrefix and merge with the numbered format.
getAsArray in interface SettingssettingPrefix - 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 valueSettingsExceptionpublic Map<String,Settings> getGroups(String settingPrefix) throws SettingsException
SettingsgetGroups in interface SettingsSettingsExceptionpublic Map<String,Settings> getGroups(String settingPrefix, boolean ignoreNonGrouped) throws SettingsException
SettingsgetGroups in interface SettingsSettingsExceptionpublic Version getAsVersion(String setting, Version defaultVersion) throws SettingsException
SettingsgetAsVersion in interface SettingsSettingsExceptionpublic String toDelimitedString(char delimiter)
SettingstoDelimitedString in interface Settingspublic static Settings readSettingsFromStream(StreamInput in) throws IOException
IOExceptionpublic static void writeSettingsToStream(Settings settings, StreamOutput out) throws IOException
IOExceptionpublic static ImmutableSettings.Builder builder()
public static ImmutableSettings.Builder settingsBuilder()
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
toXContent in interface ToXContentIOExceptionCopyright © 2009–2016. All rights reserved.