View Javadoc

1   /*
2    * $Id: JmsSelectorFilter.java 20321 2010-11-24 15:21:24Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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.transport.jms.filters;
12  
13  import static org.mule.util.ClassUtils.equal;
14  import static org.mule.util.ClassUtils.hash;
15  
16  import org.mule.api.MuleMessage;
17  import org.mule.api.routing.filter.Filter;
18  
19  /**
20   * <code>JmsSelectorFilter</code> is a wrapper for a JMS Selector. This filter
21   * should not be called. Instead the JmsConnector sets the selector on the
22   * destination to the expression set on this filer.
23   */
24  public class JmsSelectorFilter implements Filter
25  {
26  
27      private String expression = null;
28  
29      public boolean accept(MuleMessage message)
30      {
31          // If we have received the message the selector has been honoured
32          return true;
33      }
34  
35      public String getExpression()
36      {
37          return expression;
38      }
39  
40      public void setExpression(String expression)
41      {
42          this.expression = expression;
43      }
44  
45      public boolean equals(Object obj)
46      {
47          if (this == obj) return true;
48          if (obj == null || getClass() != obj.getClass()) return false;
49  
50          final JmsSelectorFilter other = (JmsSelectorFilter) obj;
51          return equal(expression, other.expression);
52      }
53  
54      public int hashCode()
55      {
56          return hash(new Object[]{this.getClass(), expression});
57      }
58  }