velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shinobu Kawai <shinobu.ka...@gmail.com>
Subject Re: EscapeTool (and velocity-tool best practices)
Date Wed, 08 Dec 2004 21:00:19 GMT
Hi Mike,

> I started using EscapeTool today (since it was far more comprehensive that my
> primitive and misnamed URLEncoder tool), and noticed that it only took
> String arguments.

Oops.

> 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?

Sounds reasonable to take Object parameters.  Quoting Nathan, "Java,
being strongly-typed, distinguishes many things that VTL tries not to
distinguish".  Just be sure to check for null.
## But hey, RenderTool takes only Strings for VTL.

> Obviously, I can easily subclass EscapeTool even if no one else agrees with
> me and add "public String html(Object object)"-like methods, but I'm curious
> what we consider to be best-practices....

Overloading in Tools currently gives strange behaviour.
  http://issues.apache.org/bugzilla/show_bug.cgi?id=13637
  http://issues.apache.org/bugzilla/show_bug.cgi?id=16707
## are these duplicates?

Best regards,
-- Shinobu Kawai

--
Shinobu Kawai <shinobu.kawai@gmail.com>

---------------------------------------------------------------------
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