org.springframework.integration.message.selector
Class MessageSelectorChain

java.lang.Object
  extended by org.springframework.integration.message.selector.MessageSelectorChain
All Implemented Interfaces:
MessageSelector

public class MessageSelectorChain
extends java.lang.Object
implements MessageSelector

A message selector implementation that passes incoming messages through a chain of selectors. The chain will be broken by any selector that returns false.

Author:
Mark Fisher

Field Summary
private  java.util.List<MessageSelector> selectors
           
 
Constructor Summary
MessageSelectorChain()
           
 
Method Summary
 boolean accept(Message<?> message)
          Pass the message through the selector chain.
 void add(int index, MessageSelector selector)
          Add a selector to the chain at the specified index.
 void add(MessageSelector selector)
          Add a selector to the end of the chain.
 void setSelectors(java.util.List<MessageSelector> selectors)
          Initialize the selector chain.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

selectors

private final java.util.List<MessageSelector> selectors
Constructor Detail

MessageSelectorChain

public MessageSelectorChain()
Method Detail

add

public void add(MessageSelector selector)
Add a selector to the end of the chain.


add

public void add(int index,
                MessageSelector selector)
Add a selector to the chain at the specified index.


setSelectors

public void setSelectors(java.util.List<MessageSelector> selectors)
Initialize the selector chain. Removes any existing selectors.


accept

public final boolean accept(Message<?> message)
Pass the message through the selector chain. As soon as a selector returns 'false', this method will return 'false'. If all selectors accept, this method will return 'true'.

Specified by:
accept in interface MessageSelector