【发布时间】:2016-01-13 23:12:05
【问题描述】:
我在 Java 中使用 StringTemplate 4.0.8。
在StringTemplate-4 documentation,它说
字典字符串也可以是可以引用属性的模板 一旦 字典值已嵌入模板中。
我该怎么做?我可以这样做吗:
output(input) ::= "The output is: <aDicitionary.input>"
aDictionary ::= [
"someKey":"someValue",
"someOtherKey":"someOtherValue",
"aCertainKey": **HERE** i want the value to be <input>,
default:"doesnt matter"
]
所以output("someKey") 的结果是The output is: someValue
和output(aCertainKey) 导致“输出为:aCertainKey”。如果是这样,语法究竟是什么样的?
我知道我可以通过在一种情况下不传递输入然后检查我是否有输入来实现相同的目的。但这会导致我在 Java 方面出现很多 if
【问题讨论】:
标签: stringtemplate stringtemplate-4