Reputation: 2209
What's wrong with the following template?
package ${packageName}
public interface ${entityName} {
<#list methods as methodName, map >
public void ${methodName}(${map}) ;
</#list>
}
which gives on version 2.3.23:
freemarker.core.ParseException: Syntax error in template "javaclass.ftl" in line 5, column 29:
Encountered ",", but was expecting:
">"
at freemarker.core.FMParser.generateParseException(FMParser.java:5251)
at freemarker.core.FMParser.jj_consume_token(FMParser.java:5122)
at freemarker.core.FMParser.List(FMParser.java:1431)
at freemarker.core.FMParser.FreemarkerDirective(FMParser.java:2827)
at freemarker.core.FMParser.MixedContent(FMParser.java:3081)
at freemarker.core.FMParser.OptionalBlock(FMParser.java:3253)
at freemarker.core.FMParser.Root(FMParser.java:3432)
at freemarker.template.Template.<init>(Template.java:208)
at freemarker.cache.TemplateCache.loadTemplate(TemplateCache.java:495)
The documentation gives the following example for a hash structure
Listing hashes is very similar, but you need to provide two variable names after the as; one for the hash key, and another for the associated value. Assuming products is { "apple": 5, "banana": 10, "kiwi": 15 }:
<#list products as name, price> <p>${name}: ${price} </#list> <p>apple: 5 <p>banan: 10 <p>kiwi: 15
Note that my example is before submitting content.
Upvotes: 4
Views: 1876
Reputation: 20243
That is expected since listing key-value was added in 2.3.25.
http://freemarker.org/docs/ref_directive_list.html#ref.directive.list
... and to list the key-value pairs of a hash (since 2.3.25):
<#list hash as key, value> Part repeated for each key-value pair </#list>
So, upgrade if you can or rewrite your list.
See also:
Upvotes: 2