Author: adrianc
Date: Mon May 14 19:57:25 2012 New Revision: 1338372 URL: http://svn.apache.org/viewvc?rev=1338372&view=rev Log: Change new FlexibleMapAccessor static method to an object method. Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleMapAccessor.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/test/FlexibleMapAccessorTests.java Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleMapAccessor.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleMapAccessor.java?rev=1338372&r1=1338371&r2=1338372&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleMapAccessor.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleMapAccessor.java Mon May 14 19:57:25 2012 @@ -76,16 +76,6 @@ public class FlexibleMapAccessor<T> impl } } - /** - * Returns <code>true</code> if <code>fma</code> contains a nested expression. - * @param fma - * @return <code>true</code> if <code>fma</code> contains a nested expression - * @throws NullPointerException if <code>fma</code> is null - */ - public static boolean containsNestedExpression(FlexibleMapAccessor<?> fma) { - return fma.fse != null; - } - /** Returns a FlexibleMapAccessor instance. * @param original The original String expression * @return A FlexibleMapAccessor instance @@ -103,6 +93,14 @@ public class FlexibleMapAccessor<T> impl return fma; } + /** + * Returns <code>true</code> if this <code>FlexibleMapAccessor</code> contains a nested expression. + * @return <code>true</code> if this <code>FlexibleMapAccessor</code> contains a nested expression + */ + public boolean containsNestedExpression() { + return fse != null; + } + public String getOriginalName() { return this.original; } Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/test/FlexibleMapAccessorTests.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/test/FlexibleMapAccessorTests.java?rev=1338372&r1=1338371&r2=1338372&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/test/FlexibleMapAccessorTests.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/test/FlexibleMapAccessorTests.java Mon May 14 19:57:25 2012 @@ -139,8 +139,8 @@ public class FlexibleMapAccessorTests ex fmaTest("UEL auto-vivify List", "parameters.someList[0]", "parameters.someList[+0]", "Hello ${parameters.someList[0]}!", null, "World", "Hello World!"); fmaTest("fse", "para${'meter'}s.var", "Hello ${parameters.var}!", "World", "Hello World!"); fmaTest("foo", "'The total is ${total?currency(USD)}.'", "total", "The total is ${total?currency(USD)}.", localeToTest, new BigDecimal("12345678.90"), "The total is $12,345,678.90."); - assertTrue("containsNestedExpression method returns true", FlexibleMapAccessor.containsNestedExpression(FlexibleMapAccessor.getInstance("Hello ${parameters.var}!"))); - assertFalse("containsNestedExpression method returns false", FlexibleMapAccessor.containsNestedExpression(FlexibleMapAccessor.getInstance("Hello World!"))); + assertTrue("containsNestedExpression method returns true", FlexibleMapAccessor.getInstance("Hello ${parameters.var}!").containsNestedExpression()); + assertFalse("containsNestedExpression method returns false", FlexibleMapAccessor.getInstance("Hello World!").containsNestedExpression()); } public static class ThrowException { |
Free forum by Nabble | Edit this page |