[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

AccessREAD_ONLY
RequiredRead Only.

The number of items the function has been applied to.

function

Configured ByELEMENT
AccessREAD_WRITE
RequiredYes.

The function to apply to beans on the bus.

name

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredNo.

The name of this component.

to

Configured ByELEMENT
AccessREAD_WRITE
RequiredNo.

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