Author: adrianc
Date: Sun May 6 09:25:49 2012
New Revision: 1334577
URL:
http://svn.apache.org/viewvc?rev=1334577&view=revLog:
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><simple-method></code> that contains <code>element</code>