static void apply(FileObject template, Writer w, Map<String,? extends Object> values, TemplateExceptionHandler teh) throws Exception {
ScriptEngineManager mgr = new ScriptEngineManager();
ScriptEngine eng = mgr.getEngineByName("freemarker");
assertNotNull("We do have such engine", eng);
eng.getContext().setWriter(w);
eng.getContext().setAttribute(FileObject.class.getName(), template, ScriptContext.ENGINE_SCOPE);
eng.getContext().getBindings(ScriptContext.ENGINE_SCOPE).putAll(values);
if (teh != null) {
eng.getContext().setAttribute("org.netbeans.libs.freemarker.exceptionHandler", teh, ScriptContext.ENGINE_SCOPE);
}
eng.eval(new InputStreamReader(template.getInputStream()));
}
ProcessorTest.java 文件源码
java
阅读 25
收藏 0
点赞 0
评论 0
项目:incubator-netbeans
作者:
评论列表
文章目录