freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Dekany (JIRA)" <>
Subject [jira] [Commented] (FREEMARKER-87) <#list map as key,value> should always iterating on map entries
Date Tue, 23 Jan 2018 16:23:00 GMT


Daniel Dekany commented on FREEMARKER-87:

{{someString.class}} was never widely supported on the first place. For user-defined POJO-s
(not a list-like, map-like, not a date, note a string, not number, etc., just some random
class) {{obj.class}} happens to work because the presence of {{Object.getClass()}} defines
a such JavaBeans property.

There's no built-in feature to detect the Java class of arbitrary values. Maybe you have good
reason to do that, but consider if you really need that (especially for something like a byte[]).
If you do, then introduce a {{TemplateHashModelEx}} that does that for you, and uses proper
{{instanceof}} check internally (a class name comparison is rather fragile).

> <#list map as key,value> should always iterating on map entries
> ---------------------------------------------------------------
>                 Key: FREEMARKER-87
>                 URL:
>             Project: Apache Freemarker
>          Issue Type: Bug
>          Components: engine
>    Affects Versions: 2.3.27-incubating
>            Reporter: Yanming Zhou
>            Priority: Major
>         Attachments:
> I'm using struts2, use FriendlyMapModel instead of default MapModel, It works fine except
map have key such as "size", the value will be unexpected SimpleMethodModel, I think freemarker
should always use entry value for directive <#list map as key,value>, not matter how MapModel
works, MapModel should only affect map.size and map.get('size').
> I attached a test case.

This message was sent by Atlassian JIRA

View raw message