use of UtilMisc.to(Map|List) in groovy and ftl

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

use of UtilMisc.to(Map|List) in groovy and ftl

Adam Heath-2
==
find -name '*.groovy' -printf '%P\n'|xargs egrep
"UtilMisc\.(toList|toMap)"|wc -l
197
find -name '*.ftl' -printf '%P\n'|xargs egrep
"Static\\[[\"']org.ofbiz.base.util.UtilMisc[\"']\\]\.(toList|toMap)"|wc -l
132
==

There is no reason to use toMap or toList in groovy or ftl files.
Both languages have native markup for maps and lists.

groovy:

map -> [plainKey: variable]
list -> [value, value]

ftl:

map -> {"plainKey": variable]
list -> [value, value]

I'm not completely certain about the ftl list syntax.  What is
annoying is that in a single ftl file, I see the native map syntax,
*and* UtilMisc.toMap.

Does anyone want to fix these?  It'd be a good way for someone to get
their feet wet with the code.  I use these kinds of changes as a way
to do a code review.