Re: TemplateModelException when unwrapping SimpleMethodModel
Rebecca Younes <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <CA5F33CB.816F%[email protected]> |
OK, I see that SimpleMethodModel.size() throws an exception, which seems to me an indication that SimpleMethodModel shouldn't implement TemplateSequenceModel in the first place. However, given that it does, what can I do to get the underlying method? Thanks. From: Rebecca Younes <[email protected]<mailto:[email protected]>> Date: Wed, 3 Aug 2011 17:10:30 -0400 To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>> Subject: TemplateModelException when unwrapping SimpleMethodModel Hello, I'm getting a TemplateModelException when I try to do DeepUnwrap.permissiveUnwrap() or DeepUnwrap.unwrap() on a SimpleMethodModel. The error is generated in the following code block, with the message "?size is unsupported for: freemarker.ext.beans.SimpleMethodModel". However, size() is defined for this class. What is going wrong, and is there a workaround so that I can get at the wrapped method? if(model instanceof TemplateSequenceModel) { TemplateSequenceModel seq = (TemplateSequenceModel)model; ArrayList list = new ArrayList(seq.size()); for(int i = 0; i < seq.size(); ++i) { list.add(unwrap(seq.get(i), nullModel, permissive)); } return list; } Thank you. Rebecca Younes ------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos & much more. Register early & save! http://p.sf.net/sfu/rim-blackberry-1 _______________________________________________ FreeMarker-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/freemarker-user