Skip to content
This repository has been archived by the owner on Sep 10, 2019. It is now read-only.

Commit

Permalink
ignore Filter model class
Browse files Browse the repository at this point in the history
  • Loading branch information
semap committed Nov 5, 2015
1 parent 2531006 commit f86ee45
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ public class CodeGenMojo extends AbstractMojo {
public void execute() throws MojoExecutionException {
Swagger swagger = new SwaggerParser().read(inputSpec);

swagger.getDefinitions().remove("Filter");

CodegenConfig config = forName(language);
config.setOutputDir(output.getAbsolutePath());

Expand Down Expand Up @@ -122,17 +124,21 @@ private void applyConfigFileSettings(final CodegenConfig config) {
}

private CodegenConfig forName(String name) {
System.out.println("0=====search config:" + name);
ServiceLoader<CodegenConfig> loader = ServiceLoader.load(CodegenConfig.class);
for (CodegenConfig config : loader) {
if (config.getName().equals(name)) {
System.out.println("1=====found config:" + config);
return config;
}
}

// else try to load directly
try {
System.out.println("2=====search config by class:" + name);
return (CodegenConfig) Class.forName(name).newInstance();
} catch (Exception e) {
System.out.println("3=====config not found:" + name);
throw new RuntimeException("Can't load config class with name ".concat(name), e);
}
}
Expand Down

0 comments on commit f86ee45

Please sign in to comment.