auto create apikey

This commit is contained in:
Jonathan Shook
2020-11-22 02:55:51 -06:00
parent cfa92eabcc
commit 3d2ff55f1c
5 changed files with 122 additions and 59 deletions

View File

@@ -31,10 +31,18 @@ public class ConfigReader extends LinkedHashMap<String, Object> {
Object o = get(name);
ConfigElement<?> elem = configModel.getElements().get(name);
if (elem == null) {
throw new RuntimeException("Invalid config element named '" + name + "'");
throw new RuntimeException("Invalid config element named '" + name + "'" );
}
Class<T> type = (Class<T>) elem.getType();
T typeCastedValue = type.cast(o);
return typeCastedValue;
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(this.configModel.getOf().getSimpleName()).append(":" );
sb.append(this.configModel.toString());
return sb.toString();
}
}