use of io.crate.common.annotations.VisibleForTesting in project crate by crate.
the class ResetSettingsPlan method buildSettingsFrom.
@VisibleForTesting
static Settings buildSettingsFrom(Set<Symbol> settings, Function<? super Symbol, Object> eval) {
Settings.Builder settingsBuilder = Settings.builder();
for (Symbol symbol : settings) {
String settingsName = eval.apply(symbol).toString();
List<String> settingNames = CrateSettings.settingNamesByPrefix(settingsName);
if (settingNames.size() == 0) {
throw new IllegalArgumentException(String.format(Locale.ENGLISH, "Setting '%s' is not supported", settingsName));
}
for (String name : settingNames) {
CrateSettings.checkIfRuntimeSetting(name);
if (CrateSettings.isValidSetting(name) == false) {
throw new IllegalArgumentException("Setting '" + settingNames + "' is not supported");
}
settingsBuilder.put(name, (String) null);
}
}
return settingsBuilder.build();
}
Aggregations