velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Bubna <nbu...@gmail.com>
Subject Re: EscapeTool (and velocity-tool best practices)
Date Thu, 09 Dec 2004 01:02:47 GMT
On Wed, 08 Dec 2004 15:21:34 -0500, Mike Kienenberger
<mkienenb@alaska.net> wrote:
...
> In general, should Velocity tools that operate on a String operate on an
> Object instead and perform a object.toString() conversion first?  Or at
> least provide Object argument wrapper methods to call the String argument
> methods?
...

in general, yes.   the type of VTL references is a) not obvious, b)
mutable, and c) not as important as its string representation (since
we're working with the ''V" in MVC here).  as such, it's usually a
good idea to accept Objects and then attempt conversion to the needed
type.  if the param is null or the conversion can't be made, then it
is usually considered best to return null rather than throw
exceptions.

these aren't hard and fast rules, but they've worked very well for me.
 and they are what i prefer when it comes to contributions/patches.
;-)

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


Mime
View raw message