fix defaulting logic on NBConfiguration

This commit is contained in:
Jonathan Shook 2022-06-30 00:36:03 -05:00
parent 3a54725d66
commit ae7107916b
2 changed files with 7 additions and 2 deletions

View File

@ -102,7 +102,11 @@ public class NBConfiguration {
Object o = data.get(name);
if (o == null) {
if (param.getDefaultValue()==null) {
throw new NBConfigError("config param '" + name + "' was not defined.");
} else {
o= param.getDefaultValue();
}
}
return ConfigModel.convertValueTo(this.getClass().getSimpleName(), name,o,type);
// if (type.isAssignableFrom(o.getClass())) {

View File

@ -293,7 +293,8 @@ public class ParsedTemplateMap implements LongFunction<Map<String, ?>>, StaticFi
public <T> T takeStaticValue(String field, Class<T> classOfT) {
if (statics.containsKey(field)) {
protomap.remove(field);
return (T) statics.remove(field);
T value = (T) statics.remove(field);
return value;
} else if (isConfig(field)) {
return getConfig(field);
}