Add support for string list configs

This commit is contained in:
embeddedt committed 2022-06-07 21:10:21 -04:00
1 parent 4cea2cd606
commit ffa5e4b12b
2 files changed
+10

No files matched your search

@@ -172,6 +172,10 @@ public class ConfigurationManager {
FalsePatternLib.getLog().warn("Invalid value " + value + " for enum configuration field " + field.getName() + " of type " + fieldClass.getName() + " in config class " + configClass.getName() + "! Using default value of " + defaultValue + "!");
field.set(null, defaultValue);
}
} else if (fieldClass.isArray() && fieldClass.getComponentType().equals(String.class)) {
val defaultValue = Optional.ofNullable(field.getAnnotation(Config.DefaultStringList.class)).map(Config.DefaultStringList::value).orElse((String[])field.get(null));
var value = rawConfig.getStringList(name, category, defaultValue, comment, null, langKey);
field.set(null, value);
} else {
throw new ConfigException("Illegal config field: " + field.getName() + " in " + configClass.getName() + ": Unsupported type " + fieldClass.getName() + "! Did you forget an @Ignore annotation?");
}