velocity-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Few suggested improvements for DisplayTools
Date Sat, 07 Feb 2009 23:41:21 GMT
I wanted to share with you a few ideas I have about new simple
improvements for DisplayTools. I should be able to make patches for
them if you are interested.

1. Add new method


that will return true if the object is null or empty (for strings it's
zero length; for collections, maps and arrays it's zero size). This
should help with  annoying null checks. (Probably a better place for
this method would be Engine, not Tools)

2. Add new "property" parameter to

list(Object list, String delim, String finaldelim, String property)

method that will format an array or collection of objects on selected
property (similar to SortTools).

3. Add new method:

stripTags(Object obj, String... allowedTags)

that will strip all (html) tags from the text except those listed in
allowedTags (allowed tags are passed like this: "br","img","p").

4. Add new method:

br(Object obj)

that will replace \n with "<br />\n"

5. Add new "preserveWords" parameter to:

truncate(Object truncateMe, int maxLength, String suffix, boolean preserveWords)

that will truncate a string to a last complete word within maxLength
instead of exact character.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message