Search in sources :

Example 1 with Response

use of com.spectralogic.ds3autogen.go.models.response.Response in project ds3_autogen by SpectraLogic.

the class GoCodeGenerator method generateResponse.

/**
     * Generates the Go code for a response handler/parser
     */
private void generateResponse(final Ds3Request ds3Request) throws IOException, TemplateException {
    final Template tmpl = getResponseTemplate(ds3Request);
    final ResponseModelGenerator<?> generator = getResponseGenerator(ds3Request);
    final Response response = generator.generate(ds3Request);
    final Path path = destDir.resolve(BASE_PROJECT_PATH.resolve(Paths.get(COMMANDS_NAMESPACE.replace(".", "/") + "/" + uncapitalize(response.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(response, writer);
    }
}
Also used : Response(com.spectralogic.ds3autogen.go.models.response.Response) Path(java.nio.file.Path) OutputStream(java.io.OutputStream) OutputStreamWriter(java.io.OutputStreamWriter) OutputStreamWriter(java.io.OutputStreamWriter) Writer(java.io.Writer)

Aggregations

Response (com.spectralogic.ds3autogen.go.models.response.Response)1 OutputStream (java.io.OutputStream)1 OutputStreamWriter (java.io.OutputStreamWriter)1 Writer (java.io.Writer)1 Path (java.nio.file.Path)1