Claude Brisson created VELOCITY-921:
---------------------------------------
Summary: Add syntactic sugar for maps handling in #foreach
Key: VELOCITY-921
URL: https://issues.apache.org/jira/browse/VELOCITY-921
Project: Velocity
Issue Type: New Feature
Components: Engine
Affects Versions: 2.2
Reporter: Claude Brisson
Assignee: Claude Brisson
`#foreach($x in $map) defaults to iterating on map values. But what if we have
to iterate on keys or on entries? Resorting to write #foreach($k in
$map.keySet()) or #foreach($e in $map.entrySet()) always bothered me. Most of
the time with maps, we'll want to iterate over keys or entries.
The proposal is to introduce optional postfixed modifiers in the #foreach
syntax, as follow:
#foreach($k in $map entries)
#foreach($k in $map keys)
#foreach($k in $map values)
the default being kept on values, as it is today. Applying the modifiers on
anything else than a map would give an error.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]