comments in line... On Sat, Feb 7, 2009 at 3:41 PM, <[email protected]> wrote: > Hello, > 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 > > isEmpty(object) > > 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)
yeah, not something for tools. would be interesting to have the Uberspect pretend that every non-null reference has an isEmpty() method, or perhaps just add 0-length strings, empty collections, empty maps and 0-length arrays to the list of things that #if( $foo ) considers false. > 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). great idea! > 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"). that would definitely be useful. but should it strip them or escape them? > 4. Add new method: > > br(Object obj) > > that will replace \n with "<br />\n" simple enough. want to make a patch for this or any of the others? > 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. also a good idea. again, want to help? i might take up a few of these, but i've got a lot of other irons in the fire. also, if you want these ideas to be remembered, opening up a JIRA issue for them would be a good idea. otherwise, they risk becoming buried in inboxes. > > Thanks. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
