Velocity
  1. Velocity
  2. VELOCITY-692

have #if handle empty strings/arrays/collections/maps more conveniently

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.x
    • Component/s: Engine
    • Labels:
      None

      Description

      An idea from the dev list:
      -------------------------------------------------------------------------------------------------
      On Sat, Feb 7, 2009 at 3:41 PM, <serg472@gmail.com> 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.
      -------------------------------------------------------------------------------------------------

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            Nathan Bubna
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development