1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package net.sf.urlchecker.events;
21
22 import net.sf.urlchecker.commands.Command;
23 import net.sf.urlchecker.commands.Context;
24
25 import org.apache.commons.lang.builder.EqualsBuilder;
26 import org.apache.commons.lang.builder.HashCodeBuilder;
27
28
29
30
31
32
33
34
35
36
37
38 public class BasicChainEvent implements ChainEvent {
39
40
41 private final Command command;
42
43
44 private final Context context;
45
46
47 private final EventTypes eventType;
48
49
50
51
52
53
54
55
56
57
58
59 public BasicChainEvent(final Command command, final Context context,
60 final EventTypes eventType) {
61 this.command = command;
62 this.context = context;
63 this.eventType = eventType;
64 }
65
66
67
68
69
70
71
72 @Override
73 public boolean equals(final Object obj) {
74 if (this == obj) {
75 return true;
76 }
77 if (obj == null) {
78 return false;
79 }
80 if (getClass() != obj.getClass()) {
81 return false;
82 }
83 final BasicChainEvent other = (BasicChainEvent) obj;
84 return new EqualsBuilder().append(context, other.getContext())
85 .append(eventType, other.getEventType()).isEquals();
86 }
87
88
89
90
91
92
93 public Command getCommand() {
94 return command;
95 }
96
97
98
99
100
101
102 public Context getContext() {
103 return context;
104 }
105
106
107
108
109
110
111 public EventTypes getEventType() {
112 return eventType;
113 }
114
115
116
117
118
119
120
121 @Override
122 public int hashCode() {
123 return new HashCodeBuilder().append(context).append(eventType)
124 .hashCode();
125 }
126
127
128
129
130
131
132
133 @Override
134 public String toString() {
135 return "BasicChainEvent [command=" + command + ", context=" + context
136 + ", eventType=" + eventType + "]";
137 }
138
139 }