[Index]
bus:map
Apply a java.util.function.Function to beans in a Bean Bus. If the result of the function. If the
function returns null then nothing is passed to the next component so this has the same effect as
an bus:filter
Property Summary
| count |
The number of items the function has been applied to. |
| function |
The function to apply to beans on the bus. |
| name |
The name of this component. |
| to |
The next component in a bus. |
Example Summary
| Example 1 |
Apply a function to double the price on a Fruit bean. |
Property Detail
count
| Access | READ_ONLY |
| Required | Read Only. |
The number of items the function has been applied to.
function
| Configured By | ELEMENT |
| Access | READ_WRITE |
| Required | Yes. |
The function to apply to beans on the bus.
name
| Configured By | ATTRIBUTE |
| Access | READ_WRITE |
| Required | No. |
The name of this component.
to
| Configured By | ELEMENT |
| Access | READ_WRITE |
| Required | No. |
The next component in a bus. Set automatically in a
bus:bus.
Examples
Example 1
Apply a function to double the price on a Fruit bean.
<oddjob>
<job>
<bus:bus id="bean-bus" xmlns:bus="oddjob:beanbus">
<of>
<bus:driver>
<values>
<list>
<values>
<value value="#{25.5}"/>
<value value="#{36.2}"/>
<value value="#{40.4}"/>
</values>
</list>
</values>
</bus:driver>
<bus:map>
<function>
<value value="#{ function(x) { return x * 2 } }"/>
</function>
</bus:map>
<bus:collect id="results"/>
</of>
</bus:bus>
</job>
</oddjob>
(c) R Gordon Ltd 2005 - Present