You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2012/05/06 11:25:50 UTC

svn commit: r1334577 - /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/MiniLangValidate.java

Author: adrianc
Date: Sun May  6 09:25:49 2012
New Revision: 1334577

URL: http://svn.apache.org/viewvc?rev=1334577&view=rev
Log:
Added a convenience method to MiniLangValidate.java.

Modified:
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/MiniLangValidate.java

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/MiniLangValidate.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/MiniLangValidate.java?rev=1334577&r1=1334576&r2=1334577&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/MiniLangValidate.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/MiniLangValidate.java Sun May  6 09:25:49 2012
@@ -58,6 +58,18 @@ public final class MiniLangValidate {
     }
 
     /**
+     * Returns <code>attributeValue</code> if it is not empty, else returns <code>defaultValue</code>.
+     * No <code>null</code> checks are performed.
+     * 
+     * @param attributeValue
+     * @param defaultValue
+     * @return
+     */
+    public static String checkAttribute(String attributeValue, String defaultValue) {
+        return attributeValue.isEmpty() ? defaultValue : attributeValue;
+    }
+
+    /**
      * Tests <code>element</code> for invalid child elements.
      * 
      * @param method The <code>&lt;simple-method&gt;</code> that contains <code>element</code>