1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
package org.mule.routing.filters.logic; |
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 | |
|
17 | |
|
18 | |
|
19 | |
public class NotFilter implements Filter |
20 | |
{ |
21 | |
private Filter filter; |
22 | |
|
23 | |
public NotFilter() |
24 | |
{ |
25 | 0 | super(); |
26 | 0 | } |
27 | |
|
28 | |
public NotFilter(Filter filter) |
29 | 0 | { |
30 | 0 | this.filter = filter; |
31 | 0 | } |
32 | |
|
33 | |
public Filter getFilter() |
34 | |
{ |
35 | 0 | return filter; |
36 | |
} |
37 | |
|
38 | |
public void setFilter(Filter filter) |
39 | |
{ |
40 | 0 | this.filter = filter; |
41 | 0 | } |
42 | |
|
43 | |
public boolean accept(MuleMessage message) |
44 | |
{ |
45 | 0 | return (filter != null ? !filter.accept(message) : false); |
46 | |
} |
47 | |
|
48 | |
public boolean equals(Object obj) |
49 | |
{ |
50 | 0 | if (this == obj) return true; |
51 | 0 | if (obj == null || getClass() != obj.getClass()) return false; |
52 | |
|
53 | 0 | final NotFilter other = (NotFilter) obj; |
54 | 0 | return equal(filter, other.filter); |
55 | |
} |
56 | |
|
57 | |
public int hashCode() |
58 | |
{ |
59 | 0 | return hash(new Object[]{this.getClass(), filter}); |
60 | |
} |
61 | |
} |