[ 
https://issues.apache.org/jira/browse/FREEMARKER-178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Steven Davelaar updated FREEMARKER-178:
---------------------------------------
    Priority: Major  (was: Critical)

> Using map or filter built-ins looses custom template model
> ----------------------------------------------------------
>
>                 Key: FREEMARKER-178
>                 URL: https://issues.apache.org/jira/browse/FREEMARKER-178
>             Project: Apache Freemarker
>          Issue Type: Bug
>          Components: engine
>    Affects Versions: 2.3.30
>            Reporter: Steven Davelaar
>            Priority: Major
>
> When you are using a custom template sequence model that implements the 
> TemplateModelWithAPISupport interface so you can use the api built-in, you 
> can no longer use the api built-in once you have applied the map or filter 
> function, because the map and filter functions then return a new instance of 
> TemplateModelListSequence, which does not implement the 
> TemplateModelWithAPISupport interface.
> For example, imagine a custom sequence model that supports the toString() 
> method, then the following works fine:
> {noformat}
> ${myList?api.toString()}{noformat}
> However, when I apply a filter, like this:
> {noformat}
> ${myList?filter(i -> i.name == 'foo')?api.toString()}{noformat}
> I get a APINotSupportedTemplateException because the filter has returned a 
> TemplateModelListSequence instance.
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to