View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.routing.filters.logic;
8   
9   import org.mule.api.MuleMessage;
10  import org.mule.api.routing.filter.Filter;
11  
12  import java.util.List;
13  
14  /**
15   * <code>OrFilter</code> accepts if any of the filters accept the message
16   */
17  
18  public class OrFilter extends AbstractFilterCollection
19  {
20      public OrFilter()
21      {
22          super();
23      }
24  
25      public OrFilter(Filter... filters)
26      {
27          super(filters);
28      }
29  
30      public OrFilter(List<Filter> filters)
31      {
32          super(filters);
33      }
34  
35      public boolean accept(MuleMessage message)
36      {
37          for (Filter filter : getFilters())
38          {
39              if(filter.accept(message))
40              {
41                  return true;
42              }
43          }
44          return false;
45      }
46  }