svn commit: r773927 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/UelUtil.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r773927 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/UelUtil.java

adrianc
Author: adrianc
Date: Tue May 12 15:09:11 2009
New Revision: 773927

URL: http://svn.apache.org/viewvc?rev=773927&view=rev
Log:
Small improvement to UEL - added $null variable name modifier so variables can be compared to null.

Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/UelUtil.java

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/UelUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/UelUtil.java?rev=773927&r1=773926&r2=773927&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/UelUtil.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/UelUtil.java Tue May 12 15:09:11 2009
@@ -142,6 +142,9 @@
                 if (variable.endsWith("$string")) {
                     name = variable.substring(0, variable.length() - 7);
                     createObjectType = "string";
+                } else if (variable.endsWith("$null")) {
+                    name = variable.substring(0, variable.length() - 5);
+                    createObjectType = "null";
                 } else if (variable.endsWith("$boolean")) {
                     name = variable.substring(0, variable.length() - 8);
                     createObjectType = "boolean";
@@ -172,6 +175,8 @@
             if (createObjectType != null) {
                 if ("string".equals(createObjectType)) {
                     return new BasicValueExpression("");
+                } else if ("null".equals(createObjectType)) {
+                    return new BasicValueExpression(null);
                 } else if ("boolean".equals(createObjectType)) {
                     return new BasicValueExpression(Boolean.FALSE);
                 } else if ("integer".equals(createObjectType)) {
@@ -202,6 +207,9 @@
             }
             try {
                 BasicValueExpression other = (BasicValueExpression) obj;
+                if (this.object == other.object) {
+                    return true;
+                }
                 return this.object.equals(other.object);
             } catch (Exception e) {}
             return false;