1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.routing.filters; |
12 | |
|
13 | |
import org.mule.umo.UMOFilter; |
14 | |
import org.mule.umo.UMOMessage; |
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
public class EqualsFilter implements UMOFilter, ObjectFilter |
21 | |
{ |
22 | |
private Object pattern; |
23 | |
|
24 | |
public EqualsFilter() |
25 | |
{ |
26 | 0 | super(); |
27 | 0 | } |
28 | |
|
29 | |
public EqualsFilter(Object compareTo) |
30 | 0 | { |
31 | 0 | this.pattern = compareTo; |
32 | 0 | } |
33 | |
|
34 | |
public boolean accept(UMOMessage message) |
35 | |
{ |
36 | 0 | return accept(message.getPayload()); |
37 | |
} |
38 | |
|
39 | |
public boolean accept(Object object) |
40 | |
{ |
41 | 0 | if (object == null && pattern == null) |
42 | |
{ |
43 | 0 | return true; |
44 | |
} |
45 | |
|
46 | 0 | if (object == null || pattern == null) |
47 | |
{ |
48 | 0 | return false; |
49 | |
} |
50 | |
|
51 | 0 | return pattern.equals(object); |
52 | |
} |
53 | |
|
54 | |
public Object getPattern() |
55 | |
{ |
56 | 0 | return pattern; |
57 | |
} |
58 | |
|
59 | |
public void setPattern(Object pattern) |
60 | |
{ |
61 | 0 | this.pattern = pattern; |
62 | 0 | } |
63 | |
|
64 | |
} |