Class Setting<T>

java.lang.Object
org.elasticsearch.common.settings.Setting<T>
All Implemented Interfaces:
ToXContent, ToXContentObject
Direct Known Subclasses:
SecureSetting, Setting.AffixSetting

public class Setting<T> extends Object implements ToXContentObject
A setting. Encapsulates typical stuff like default value, parsing, and scope. Some (SettingsProperty.Dynamic) can by modified at run time using the API. All settings inside elasticsearch or in any of the plugins should use this type-safe and generic settings infrastructure together with AbstractScopedSettings. This class contains several utility methods that makes it straight forward to add settings for the majority of the cases. For instance a simple boolean settings can be defined like this:

 public static final Setting<Boolean>; MY_BOOLEAN = Setting.boolSetting("my.bool.setting", true, SettingsProperty.NodeScope);
 
To retrieve the value of the setting a Settings object can be passed directly to the get(Settings) method.
 final boolean myBooleanValue = MY_BOOLEAN.get(settings);
 
It's recommended to use typed settings rather than string based settings. For example adding a setting for an enum type:

 public enum Color {
     RED, GREEN, BLUE;
 }
 public static final Setting<Color> MY_BOOLEAN =
     new Setting<>("my.color.setting", Color.RED.toString(), Color::valueOf, SettingsProperty.NodeScope);