org.mule.routing.outbound
Class PartitionedMessageSequence<Q>

java.lang.Object
  extended by org.mule.routing.outbound.PartitionedMessageSequence<Q>
All Implemented Interfaces:
Iterator<Collection<Q>>, MessageSequence<Collection<Q>>

public class PartitionedMessageSequence<Q>
extends Object
implements MessageSequence<Collection<Q>>

A MessageSequence wrapper that partitions the wrapped sequence in collections of the specified size.


Field Summary
 
Fields inherited from interface org.mule.routing.MessageSequence
UNKNOWN_SIZE
 
Constructor Summary
PartitionedMessageSequence(MessageSequence<Q> seq, int groupSize)
           
 
Method Summary
 boolean hasNext()
          Whether this sequence has more elements.
 boolean isEmpty()
          If the sequence is empty
 Collection<Q> next()
          The next element of the sequence.
 void remove()
          Unsupported operation.
 int size()
          The number of members of the sequence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PartitionedMessageSequence

public PartitionedMessageSequence(MessageSequence<Q> seq,
                                  int groupSize)
Method Detail

size

public int size()
Description copied from interface: MessageSequence
The number of members of the sequence. If this is unknown, return UNKNOWN_ELEMENTS_COUNT.

Specified by:
size in interface MessageSequence<Collection<Q>>
Returns:
The estimated size of the sequence, or MessageSequence.UNKNOWN_SIZE, if it is unknown

hasNext

public boolean hasNext()
Description copied from interface: MessageSequence
Whether this sequence has more elements.

Specified by:
hasNext in interface Iterator<Collection<Q>>
Specified by:
hasNext in interface MessageSequence<Collection<Q>>
See Also:
Iterator.hasNext()

next

public Collection<Q> next()
Description copied from interface: MessageSequence
The next element of the sequence. At any moment, if MessageSequence.size() is not equal to MessageSequence.UNKNOWN_SIZE, this means that this method may be invoked approximately up to MessageSequence.size() times.

Specified by:
next in interface Iterator<Collection<Q>>
Specified by:
next in interface MessageSequence<Collection<Q>>

isEmpty

public boolean isEmpty()
Description copied from interface: MessageSequence
If the sequence is empty

Specified by:
isEmpty in interface MessageSequence<Collection<Q>>
Returns:
!hasNext()

remove

public void remove()
Description copied from interface: MessageSequence
Unsupported operation. MessageSequence do not allow removal of elements.

Specified by:
remove in interface Iterator<Collection<Q>>
Specified by:
remove in interface MessageSequence<Collection<Q>>


Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.