You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by ChadDavis <ch...@gmail.com> on 2009/06/26 19:52:42 UTC

macros parameter type checking

I have a macro that takes an integer parameter.  AFAIK, there's no
support for typing in the Velocity language.  How can I verify that
the parameter is an integer value before doing my velocity macro
logic?

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: macros parameter type checking

Posted by Nathan Bubna <nb...@gmail.com>.
#if( $foo.class.name == "java.lang.Integer" )

or just don't give your macro to an untrusted user.  or if you can at
least trust the user to pass a number, then $foo.intValue() is all you
need.

On Fri, Jun 26, 2009 at 10:52 AM, ChadDavis<ch...@gmail.com> wrote:
> I have a macro that takes an integer parameter.  AFAIK, there's no
> support for typing in the Velocity language.  How can I verify that
> the parameter is an integer value before doing my velocity macro
> logic?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org