use of com.spectralogic.ds3autogen.go.models.request.Request in project ds3_autogen by SpectraLogic.
the class GoCodeGenerator method generateRequest.
/**
* Generates the Go code for a request handler
*/
private void generateRequest(final Ds3Request ds3Request) throws IOException, TemplateException {
final Template tmpl = getRequestTemplate(ds3Request);
final RequestModelGenerator<?> generator = getRequestGenerator(ds3Request);
final Request request = generator.generate(ds3Request);
final Path path = destDir.resolve(BASE_PROJECT_PATH.resolve(Paths.get(COMMANDS_NAMESPACE.replace(".", "/") + "/" + uncapitalize(request.getName()) + ".go")));
LOG.info("Getting Output Stream for file: {}", path.toString());
try (final OutputStream outputStream = fileUtils.getOutputFile(path);
final Writer writer = new OutputStreamWriter(outputStream)) {
tmpl.process(request, writer);
}
}
Aggregations