use of org.stringtemplate.v4.STRawGroupDir in project stagen by wiztools.
the class STTemplateExecutor method render.
@Override
public String render(Map<String, Object> config, File templateFile) throws ExecutorException {
try {
final File tmplDir = templateFile.getParentFile();
final String tmplName = Util.getBaseFileName(templateFile.getName());
STGroup stg = new STRawGroupDir(tmplDir.toURI().toURL(), Charsets.UTF_8.name(), delimiterStartChar, delimiterStopChar);
ST st = stg.getInstanceOf(tmplName);
// Populate data:
config.entrySet().stream().forEach((e) -> {
st.add(e.getKey(), e.getValue());
});
return st.render();
} catch (MalformedURLException ex) {
throw new ExecutorException(ex);
}
}
Aggregations