Internal: Remove unused Settings methods taking multiple setting names

The Settings class has an enormous amount of methods with variations of
parameters. This change removes all the methods which take multiple
setting names, which were completely unused.
This commit is contained in:
Ryan Ernst 2016-04-19 16:31:02 -07:00
parent 249a635ce1
commit d2c0e81f11
1 changed files with 0 additions and 158 deletions

View File

@ -247,19 +247,6 @@ public final class Settings implements ToXContent {
return forcedUnderscoreSettings.get(setting);
}
/**
* Returns the setting value associated with the first setting key.
*/
public String get(String[] settings) {
for (String setting : settings) {
String retVal = get(setting);
if (retVal != null) {
return retVal;
}
}
return null;
}
/**
* Returns the setting value associated with the setting key. If it does not exists,
* returns the default value provided.
@ -269,15 +256,6 @@ public final class Settings implements ToXContent {
return retVal == null ? defaultValue : retVal;
}
/**
* Returns the setting value associated with the first setting key, if none exists,
* returns the default value provided.
*/
public String get(String[] settings, String defaultValue) {
String retVal = get(settings);
return retVal == null ? defaultValue : retVal;
}
/**
* Returns the setting value (as float) associated with the setting key. If it does not exists,
* returns the default value provided.
@ -294,22 +272,6 @@ public final class Settings implements ToXContent {
}
}
/**
* Returns the setting value (as float) associated with teh first setting key, if none
* exists, returns the default value provided.
*/
public Float getAsFloat(String[] settings, Float defaultValue) throws SettingsException {
String sValue = get(settings);
if (sValue == null) {
return defaultValue;
}
try {
return Float.parseFloat(sValue);
} catch (NumberFormatException e) {
throw new SettingsException("Failed to parse float setting [" + Arrays.toString(settings) + "] with value [" + sValue + "]", e);
}
}
/**
* Returns the setting value (as double) associated with the setting key. If it does not exists,
* returns the default value provided.
@ -326,23 +288,6 @@ public final class Settings implements ToXContent {
}
}
/**
* Returns the setting value (as double) associated with teh first setting key, if none
* exists, returns the default value provided.
*/
public Double getAsDouble(String[] settings, Double defaultValue) {
String sValue = get(settings);
if (sValue == null) {
return defaultValue;
}
try {
return Double.parseDouble(sValue);
} catch (NumberFormatException e) {
throw new SettingsException("Failed to parse double setting [" + Arrays.toString(settings) + "] with value [" + sValue + "]", e);
}
}
/**
* Returns the setting value (as int) associated with the setting key. If it does not exists,
* returns the default value provided.
@ -359,22 +304,6 @@ public final class Settings implements ToXContent {
}
}
/**
* Returns the setting value (as int) associated with the first setting key. If it does not exists,
* returns the default value provided.
*/
public Integer getAsInt(String[] settings, Integer defaultValue) {
String sValue = get(settings);
if (sValue == null) {
return defaultValue;
}
try {
return Integer.parseInt(sValue);
} catch (NumberFormatException e) {
throw new SettingsException("Failed to parse int setting [" + Arrays.toString(settings) + "] with value [" + sValue + "]", e);
}
}
/**
* Returns the setting value (as long) associated with the setting key. If it does not exists,
* returns the default value provided.
@ -391,22 +320,6 @@ public final class Settings implements ToXContent {
}
}
/**
* Returns the setting value (as long) associated with the setting key. If it does not exists,
* returns the default value provided.
*/
public Long getAsLong(String[] settings, Long defaultValue) {
String sValue = get(settings);
if (sValue == null) {
return defaultValue;
}
try {
return Long.parseLong(sValue);
} catch (NumberFormatException e) {
throw new SettingsException("Failed to parse long setting [" + Arrays.toString(settings) + "] with value [" + sValue + "]", e);
}
}
/**
* Returns the setting value (as boolean) associated with the setting key. If it does not exists,
* returns the default value provided.
@ -415,14 +328,6 @@ public final class Settings implements ToXContent {
return Booleans.parseBoolean(get(setting), defaultValue);
}
/**
* Returns the setting value (as boolean) associated with the setting key. If it does not exists,
* returns the default value provided.
*/
public Boolean getAsBoolean(String[] settings, Boolean defaultValue) {
return Booleans.parseBoolean(get(settings), defaultValue);
}
/**
* Returns the setting value (as time) associated with the setting key. If it does not exists,
* returns the default value provided.
@ -431,21 +336,6 @@ public final class Settings implements ToXContent {
return parseTimeValue(get(setting), defaultValue, setting);
}
/**
* Returns the setting value (as time) associated with the setting key. If it does not exists,
* returns the default value provided.
*/
public TimeValue getAsTime(String[] settings, TimeValue defaultValue) {
// NOTE: duplicated from get(String[]) so we can pass which setting name was actually used to parseTimeValue:
for (String setting : settings) {
String retVal = get(setting);
if (retVal != null) {
parseTimeValue(get(settings), defaultValue, setting);
}
}
return defaultValue;
}
/**
* Returns the setting value (as size) associated with the setting key. If it does not exists,
* returns the default value provided.
@ -454,21 +344,6 @@ public final class Settings implements ToXContent {
return parseBytesSizeValue(get(setting), defaultValue, setting);
}
/**
* Returns the setting value (as size) associated with the setting key. If it does not exists,
* returns the default value provided.
*/
public ByteSizeValue getAsBytesSize(String[] settings, ByteSizeValue defaultValue) throws SettingsException {
// NOTE: duplicated from get(String[]) so we can pass which setting name was actually used to parseBytesSizeValue
for (String setting : settings) {
String retVal = get(setting);
if (retVal != null) {
parseBytesSizeValue(get(settings), defaultValue, setting);
}
}
return defaultValue;
}
/**
* 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
@ -478,22 +353,6 @@ public final class Settings implements ToXContent {
return MemorySizeValue.parseBytesSizeValueOrHeapRatio(get(setting, defaultValue), setting);
}
/**
* 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.
*/
public ByteSizeValue getAsMemory(String[] settings, String defaultValue) throws SettingsException {
// NOTE: duplicated from get(String[]) so we can pass which setting name was actually used to parseBytesSizeValueOrHeapRatio
for (String setting : settings) {
String retVal = get(setting);
if (retVal != null) {
return MemorySizeValue.parseBytesSizeValueOrHeapRatio(retVal, setting);
}
}
return MemorySizeValue.parseBytesSizeValueOrHeapRatio(defaultValue, settings[0]);
}
/**
* Returns the setting value (as a RatioValue) associated with the setting key. Provided values can
* either be a percentage value (eg. 23%), or expressed as a floating point number (eg. 0.23). If
@ -503,15 +362,6 @@ public final class Settings implements ToXContent {
return RatioValue.parseRatioValue(get(setting, defaultValue));
}
/**
* Returns the setting value (as a RatioValue) associated with the setting key. Provided values can
* either be a percentage value (eg. 23%), or expressed as a floating point number (eg. 0.23). If
* it does not exist, parses the default value provided.
*/
public RatioValue getAsRatio(String[] settings, String defaultValue) throws SettingsException {
return RatioValue.parseRatioValue(get(settings, defaultValue));
}
/**
* Returns the setting value (as size) associated with the setting key. If it does not exists,
* returns the default value provided.
@ -520,14 +370,6 @@ public final class Settings implements ToXContent {
return parseSizeValue(get(setting), defaultValue);
}
/**
* Returns the setting value (as size) associated with the setting key. If it does not exists,
* returns the default value provided.
*/
public SizeValue getAsSize(String[] settings, SizeValue defaultValue) throws SettingsException {
return parseSizeValue(get(settings), defaultValue);
}
/**
* The values associated with a setting prefix as an array. The settings array is in the format of:
* <tt>settingPrefix.[index]</tt>.