StCompiler extends AbstractProtoCompiler { protected void compile(String templateName, String templateArgName, Object templateArgValue, Writer writer) { ST st = stGroup.getInstanceOf(templateName); if (st == null) { throw new GeneratorException("Template %s is not defined", templateName); } st.add(templateArgName, templateArgValue); String result = st.render(); try { writer.append(result); } catch (IOException e) { throw new GeneratorException("Could not write file: %s", e.getMessage(), e); } } @Inject  StCompiler(OutputStreamFactory outputStreamFactory,
                      @Assisted String templateFileName);   }
@Test @Disabled public void test() throws Exception { Importer importer = injector.getInstance(Importer.class); ProtoContext context = importer.importFile(new ClasspathFileReader(), "protostuff_unittest/messages_sample.proto"); Proto proto = context.getProto(); StCompilerFactory compilerFactory = injector.getInstance(StCompilerFactory.class); ProtoCompiler compiler = compilerFactory.create("io/protostuff/generator/proto/proto3.stg"); Module module = ImmutableModule.builder() .addProtos(proto) .output("./") .usageIndex(UsageIndex.build(Collections.emptyList())) .build(); compiler.compile(module); }