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.cache.filter;
8   
9   import org.mule.DefaultMuleMessage;
10  import org.mule.api.MuleMessage;
11  import org.mule.api.routing.filter.Filter;
12  
13  /**
14   * Filters messages that have a consumable payload.
15   * <p/>
16   * The filter accepts only {@link DefaultMuleMessage} instances that
17   * have a no consumable payload. Check is done using
18   * {@link org.mule.DefaultMuleMessage#isConsumable()} method.
19   */
20  public class ConsumableMuleMessageFilter implements Filter
21  {
22  
23      public boolean accept(MuleMessage message)
24      {
25  
26          if (message instanceof DefaultMuleMessage)
27          {
28              return !((DefaultMuleMessage) message).isConsumable();
29          }
30          else
31          {
32              return false;
33          }
34      }
35  }