View Javadoc

1   /*
2    * $Id: NotFilter.java 10489 2008-01-23 17:53:38Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.routing.filters.logic;
12  
13  import org.mule.api.MuleMessage;
14  import org.mule.api.routing.filter.Filter;
15  
16  /**
17   * <code>NotFilter</code> accepts if the filter does not accept.
18   */
19  
20  public class NotFilter implements Filter
21  {
22      private Filter filter;
23  
24      public NotFilter()
25      {
26          super();
27      }
28  
29      public NotFilter(Filter filter)
30      {
31          this.filter = filter;
32      }
33  
34      public Filter getFilter()
35      {
36          return filter;
37      }
38  
39      public void setFilter(Filter filter)
40      {
41          this.filter = filter;
42      }
43  
44      public boolean accept(MuleMessage message)
45      {
46          return (filter != null ? !filter.accept(message) : false);
47      }
48  
49  }