This map will be converted to a map of string to objects during configuration of a job.
As yet there is no merging of maps supported by this type.
element | |
elementType | The required element type. |
values | Any values. |
Example 1 | A simple map with element access. |
Example 2 | Adding additional elements to a map. |
Access | READ_ONLY |
Configured By | ELEMENT |
Access | READ_WRITE |
Required | No. Elements will be left being what they want to be. |
The required element type. If this is specified all elements of the array will attempt to be converted to this type.
Configured By | ELEMENT |
Access | READ_WRITE |
Required | No. |
Any values.
A simple map with element access.
<oddjob> <job> <sequential> <jobs> <properties> <values> <value key="night.type" value="school night"/> </values> </properties> <variables id="vars"> <beersAllowed> <map> <elementType> <class name="int"/> </elementType> <values> <value key="weekend" value="4"/> <value key="school night" value="1"/> </values> </map> </beersAllowed> </variables> <echo>On a ${night.type} I am allowed ${vars.beersAllowed.element(${night.type})} beer(s).</echo> </jobs> </sequential> </job> </oddjob>The output is:
On a school night I am allowed 1 beer(s).
Adding additional elements to a map. Also demonstrates iterable access to the map.
<oddjob id="this"> <job> <sequential> <jobs> <variables id="vars"> <aMap> <map/> </aMap> </variables> <set> <values> <value key="vars.aMap.add(morning snack)" value="apples"/> </values> </set> <set> <values> <value key="vars.aMap.add(afternoon snack)" value="bananas"/> </values> </set> <repeat id="each"> <values> <value value="${vars.aMap}"/> </values> <job> <echo>${each.current.key} is ${each.current.value}</echo> </job> </repeat> </jobs> </sequential> </job> </oddjob>The output is:
morning snack is apples afternoon snack is bananas