给出Freemarker模板
class ${name.capitalize()}
和数据
val data = mapOf("name" to "test")
我想通过在capitalize()
上应用扩展方法name
得到以下结果:
class Test
但是,会引发错误:
FreeMarker template error:
For "." left-hand operand: Expected a hash, but this has evaluated to a string (wrapper: f.t.SimpleScalar):
==> name [in template "table.ftl" at line 1, column 24]
----
FTL stack trace ("~" means nesting-related):
- Failed at: ${name.capitalize()} [in template "table.ftl" at line 1, column 22]
----