1
2
3
4
5
6
7
8
9
10
11 package org.mule.tck.testmodels.fruit;
12
13 import org.mule.api.MuleEventContext;
14
15
16
17
18
19 public class Kiwi implements Fruit
20 {
21
22
23
24 private static final long serialVersionUID = -1468423665948468954L;
25
26 private boolean bitten;
27
28 public void handle(MuleEventContext eventContext) throws Exception
29 {
30 final Object payload = eventContext.getMessage().getPayload();
31 if (payload instanceof FruitLover)
32 {
33 this.bite();
34 }
35 }
36
37 public void bite()
38 {
39 this.bitten = true;
40 }
41
42 public boolean isBitten()
43 {
44 return this.bitten;
45 }
46
47 @Override
48 public boolean equals(Object o)
49 {
50 if (this == o)
51 {
52 return true;
53 }
54 if (!(o instanceof Kiwi))
55 {
56 return false;
57 }
58
59 Kiwi kiwi = (Kiwi) o;
60
61 if (bitten != kiwi.bitten)
62 {
63 return false;
64 }
65
66 return true;
67 }
68
69 @Override
70 public int hashCode()
71 {
72 return (bitten ? 1 : 0);
73 }
74 }