Re: Varargs

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Tuesday, August 2, 2011, 9:20:43 PM, Brian Pontarelli wrote:

> I've read that vararg method calls were added to 2.4.12 but I can't
> find any good docs on how to use them and if there are any special
> requirements. I have a varargs method that I'm trying to invoke from
> a template and I'm getting an argument type mismatch exception:
>
>   public boolean hasRoles(String... roles) {
>     ...
>   }
>
>
>   [#if user.hasRoles(["foo", "bar"])]
>     …
>   [/#if]
>
> Anyone know how to fix this?

AFAR it's supposed to Just Work (assuming you are using some
BeansWrapper subclass as the object_wrapper setting, and it's 99% that
you do). Have you tried user.hasRoles("foo", "bar"), without the []?

> -bp

-- 
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
BlackBerry&reg; 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.