Class IterableBusDriver<T>

java.lang.Object
org.oddjob.beanbus.drivers.IterableBusDriver<T>
Type Parameters:
T - The generic type of the Iterable.
All Implemented Interfaces:
Runnable, Outbound<T>, Stoppable

public class IterableBusDriver<T> extends Object implements Runnable, Stoppable, Outbound<T>
Author:
Rob

Description

Drives data from an iterable (such as a ListType) through a Bean Bus. It can also be used outside Bean Bus to push data to any Consumer.

Example

Drive 3 Beans through a Bean Bus.
<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

    • IterableBusDriver

      public IterableBusDriver()
  • Method Details

    • reset

      public void reset()
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • stop

      public void stop() throws FailedToStopException
      Description copied from interface: Stoppable
      Stop executing. This method should not return until the Stoppable has actually stopped.
      Specified by:
      stop in interface Stoppable
      Throws:
      FailedToStopException
    • getValues

      public Iterable<? extends T> getValues()
    • setValues

      public void setValues(Iterable<? extends T> iterable)
      The data to iterate over.
      Parameters:
      iterable - The iterable.
    • getName

      public String getName()
    • setName

      public void setName(String name)
    • setTo

      public void setTo(Consumer<? super T> to)
      Set the destination.
      Specified by:
      setTo in interface Outbound<T>
      Parameters:
      to -
    • getTo

      public Consumer<? super T> getTo()
    • getCount

      public int getCount()
    • toString

      public String toString()
      Overrides:
      toString in class Object