[Index]

bus:map


Apply a java.util.function.Function to beans in a Bean Bus.

Property Summary

count  
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

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>
                                <bean class="org.oddjob.beanbus.example.Fruit" quantity="42" type="Apple" price="25.5"/>
                                <bean class="org.oddjob.beanbus.example.Fruit" quantity="24" type="Banana" price="36.2"/>
                                <bean class="org.oddjob.beanbus.example.Fruit" quantity="15" type="Pear" price="40.4"/>
                            </values>
                        </list>
                    </values>
                </bus:driver>
                <bus:map>
                    <function>
                        <bean class="org.oddjob.beanbus.example.DoublePrice"/>
                    </function>
                </bus:map>
                <bus:collect id="results"/>
            </of>
        </bus:bus>
    </job>
</oddjob>


(c) R Gordon Ltd 2005 - Present