Class BusMap<F,T>

java.lang.Object
org.oddjob.beanbus.AbstractFilter<F,T>
org.oddjob.beanbus.destinations.BusMap<F,T>
Type Parameters:
F - The accepting from type.
T - The onward to type.
All Implemented Interfaces:
Consumer<F>, BusFilter<F,T>, Outbound<T>

public class BusMap<F,T> extends AbstractFilter<F,T> implements BusFilter<F,T>
Author:
rob

Description

Apply a 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 BeanFilter

Example

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>
  • Constructor Details

    • BusMap

      public BusMap()
  • Method Details

    • filter

      protected T filter(F from)
      Specified by:
      filter in class AbstractFilter<F,T>
    • reset

      public void reset()
    • getFunction

      public Function<? super F,? extends T> getFunction()
    • setFunction

      public void setFunction(Function<? super F,? extends T> filter)
    • getCount

      public int getCount()