return config;
}
private Object createConfiguration(Class<?> type, Object extension) {
if (!(extension instanceof IGlobalExtension)) {
throw new ExtensionException("Extension '%s' references unknown configuration class '%s'")
.withArgs(extension.getClass(), type);
}
try {
return type.newInstance();
} catch (InstantiationException e) {
throw new ExtensionException("Cannot instantiate configuration class %s").withArgs(type);
} catch (IllegalAccessException e) {
throw new ExtensionException("Configuration class '%s' has no public no-arg constructor").withArgs(type);
}
}