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