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