Uploaded image for project: 'XWiki Commons'
  1. XWiki Commons
  2. XCOMMONS-1866

Add a Velocity directive that tests for null

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 12.0-rc-1
    • Fix Version/s: None
    • Component/s: Velocity
    • Labels:
      None
    • Difficulty:
      Unknown
    • Documentation:
      N/A
    • Documentation in Release Notes:
      N/A
    • Similar issues:

      Description

      It's not always easy with Velocity to check for null. You can use some tricks such as "#if ($variable == $NULL)" or "#if (!$variable)". However Velocity performs some conversions, calling methods such as getAsBoolean() or getAsString(). There are cases when you don't want them to be called as they can clash with your own implementation (note: this is the case for JsonObject from gson for ex).

      If you need to check only for null, this directive is probably the best for that.

        Attachments

          Activity

            People

            Assignee:
            vmassol Vincent Massol
            Reporter:
            vmassol Vincent Massol
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: