added some useful log/output messages and exception handling

This commit is contained in:
F481
2015-08-24 14:04:50 +02:00
parent 3f8dbf416d
commit 0261121d78
4 changed files with 94 additions and 42 deletions

View File

@@ -78,17 +78,19 @@ public class Generate implements Runnable {
*/
private static CodegenConfig forName(String name) {
ServiceLoader<CodegenConfig> loader = load(CodegenConfig.class);
String available = "";
for (CodegenConfig config : loader) {
if (config.getName().equals(name)) {
return config;
}
available = available + config.getName() + "\n";
}
// else try to load directly
try {
return (CodegenConfig) Class.forName(name).newInstance();
} catch (Exception e) {
throw new RuntimeException("Can't load config class with name ".concat(name), e);
throw new RuntimeException("Can't load config class with name ".concat(name) + "Available: "+available, e);
}
}