You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Adam Heath <do...@brainfood.com> on 2012/05/14 21:49:51 UTC
Re: svn commit: r1338361 - in /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections:
FlexibleMapAccessor.java test/FlexibleMapAccessorTests.java
On 05/14/2012 02:43 PM, adrianc@apache.org wrote:
> Author: adrianc
> Date: Mon May 14 19:43:18 2012
> New Revision: 1338361
>
> URL: http://svn.apache.org/viewvc?rev=1338361&view=rev
> Log:
> Added a utility method to FlexibleMapAccessor.java to test for nested expressions.
>
> 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=1338361&r1=1338360&r2=1338361&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:43:18 2012
> @@ -76,6 +76,16 @@ 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;
> + }
> +
Just make it a method on the object itself, so one can do:
fma.containsNestedExpression()
Re: svn commit: r1338361 - in /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections:
FlexibleMapAccessor.java test/FlexibleMapAccessorTests.java
Posted by Adam Heath <do...@brainfood.com>.
On 05/14/2012 02:49 PM, Adam Heath wrote:
> On 05/14/2012 02:43 PM, adrianc@apache.org wrote:
>> Author: adrianc
>> Date: Mon May 14 19:43:18 2012
>> New Revision: 1338361
>>
>> URL: http://svn.apache.org/viewvc?rev=1338361&view=rev
>> Log:
>> Added a utility method to FlexibleMapAccessor.java to test for nested expressions.
>>
>> 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=1338361&r1=1338360&r2=1338361&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:43:18 2012
>> @@ -76,6 +76,16 @@ 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;
>> + }
>> +
>
> Just make it a method on the object itself, so one can do:
>
> fma.containsNestedExpression()
Thanks, Adrian, for changing that.
Generally, ofbiz uses static methods for lots of things, and then uses
generic objects(simple collection objects, strings, etc). Howeverr,
in this case, we already have a custom object, doing various things,
so the feature should just be a new method on that.