|
@@ -426,8 +426,19 @@ public class Setting<T> implements ToXContentObject {
|
|
|
* Returns the raw (string) settings value. If the setting is not present in the given settings object the default value is returned
|
|
|
* instead. This is useful if the value can't be parsed due to an invalid value to access the actual value.
|
|
|
*/
|
|
|
- public String getRaw(Settings settings) {
|
|
|
+ public final String getRaw(final Settings settings) {
|
|
|
checkDeprecation(settings);
|
|
|
+ return innerGetRaw(settings);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * The underlying implementation for {@link #getRaw(Settings)}. Setting specializations can override this as needed to convert the
|
|
|
+ * actual settings value to raw strings.
|
|
|
+ *
|
|
|
+ * @param settings the settings instance
|
|
|
+ * @return the raw string representation of the setting value
|
|
|
+ */
|
|
|
+ String innerGetRaw(final Settings settings) {
|
|
|
return settings.get(getKey(), defaultValue.apply(settings));
|
|
|
}
|
|
|
|
|
@@ -713,7 +724,7 @@ public class Setting<T> implements ToXContentObject {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String getRaw(Settings settings) {
|
|
|
+ public String innerGetRaw(final Settings settings) {
|
|
|
throw new UnsupportedOperationException("affix settings can't return values" +
|
|
|
" use #getConcreteSetting to obtain a concrete setting");
|
|
|
}
|
|
@@ -820,7 +831,7 @@ public class Setting<T> implements ToXContentObject {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String getRaw(Settings settings) {
|
|
|
+ public String innerGetRaw(final Settings settings) {
|
|
|
Settings subSettings = get(settings);
|
|
|
try {
|
|
|
XContentBuilder builder = XContentFactory.jsonBuilder();
|
|
@@ -913,7 +924,7 @@ public class Setting<T> implements ToXContentObject {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String getRaw(Settings settings) {
|
|
|
+ String innerGetRaw(final Settings settings) {
|
|
|
List<String> array = settings.getAsList(getKey(), null);
|
|
|
return array == null ? defaultValue.apply(settings) : arrayToParsableString(array);
|
|
|
}
|