freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Dekany (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (FREEMARKER-87) <#list map as key,value> should always iterating on map entries
Date Fri, 19 Jan 2018 09:45:01 GMT

    [ https://issues.apache.org/jira/browse/FREEMARKER-87?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16332004#comment-16332004
] 

Daniel Dekany edited comment on FREEMARKER-87 at 1/19/18 9:44 AM:
------------------------------------------------------------------

You can just use {{DefaultObjectWrapper}} or {{DefaultMapAdapter}} if you only want to avoid
methods appearing as keys. Implementing {{TemplateHashModelEx2}} is certainly not the right
fix alone, as you will still get the unwanted keys with {{?keys}}. But again, I'm not sure
what the purpose of {{FriendlyMapModel}} is, and why do chose {{MapModel}} as its super class.
I would void {{MapModel}}.


was (Author: ddekany):
You can just use {{DefaultObjectWrapper}} or {{DefaultMapAdapter}} if you only want to methods
appearing as keys. Implementing `TemplateHashModelEx2` is certainly not the right fix alone,
as you will still get the unwanted keys with {{?keys}}. But again, I'm not sure what the purpose
of `FriendlyMapModel` is, and why do chose {{MapModel}} as its super class. I would void {{MapModel}}.

> <#list map as key,value> should always iterating on map entries
> ---------------------------------------------------------------
>
>                 Key: FREEMARKER-87
>                 URL: https://issues.apache.org/jira/browse/FREEMARKER-87
>             Project: Apache Freemarker
>          Issue Type: Bug
>          Components: engine
>    Affects Versions: 2.3.27-incubating
>            Reporter: Yanming Zhou
>            Priority: Major
>         Attachments: MapIteratingTest.java
>
>
> 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
(v7.6.3#76005)

Mime
View raw message