我有以下階和碼的freemarker(。):Scala中返回到一些的Freemarker
val cfg = new Configuration(Configuration.VERSION_2_3_23)
cfg.setDirectoryForTemplateLoading(new File("/Users/simonshapiro/IdeaProjects/Neo4EmbeddedTest/src/main/scala-2.11/informationModel/kernel/templates"))
cfg.setDefaultEncoding("UTF-8")
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER)
val template = cfg.getTemplate("test.ftl")
val out = new StringWriter
val data = new mutable.HashMap[String, Any]
data("name") = "fred"
data("age") = 27
template.process(data, out)
println(out.toString)
test.ftl包含:
Hi ${name}(${age})
one two three
從該短程序的輸出是:
Hi Some(fred)(Some(27))
one two three
如何從生成的模板中得到沒有圍繞字符串值的Some(。)文本的輸出?