1 package org.apache.velocity.app.event;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.velocity.context.Context;
23 import org.apache.velocity.util.introspection.Info;
24
25
26
27
28
29
30
31
32
33
34
35
36 public interface InvalidReferenceEventHandler extends EventHandler
37 {
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53 public Object invalidGetMethod(Context context, String reference,
54 Object object, String property, Info info);
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71 public boolean invalidSetMethod(Context context, String leftreference,
72 String rightreference, Info info);
73
74
75
76
77
78
79
80
81
82
83
84
85
86 public Object invalidMethod(Context context, String reference,
87 Object object, String method, Info info);
88
89
90
91
92
93 static class InvalidGetMethodExecutor implements EventHandlerMethodExecutor
94 {
95 private Context context;
96 private String reference;
97 private Object object;
98 private String property;
99 private Info info;
100
101 private Object result;
102
103 InvalidGetMethodExecutor(
104 Context context,
105 String reference,
106 Object object,
107 String property,
108 Info info)
109 {
110 this.context = context;
111 this.reference = reference;
112 this.object = object;
113 this.property = property;
114 this.info = info;
115 }
116
117
118
119
120
121
122 public void execute(EventHandler handler)
123 {
124 result = ((InvalidReferenceEventHandler) handler).invalidGetMethod(
125 context, reference, object, property, info);
126 }
127
128 public Object getReturnValue()
129 {
130 return result;
131 }
132
133 public boolean isDone()
134 {
135 return (result != null);
136 }
137 }
138
139
140
141
142 static class InvalidSetMethodExecutor implements EventHandlerMethodExecutor
143 {
144 private Context context;
145 private String leftreference;
146 private String rightreference;
147 private Info info;
148
149 private boolean result;
150
151 InvalidSetMethodExecutor(
152 Context context,
153 String leftreference,
154 String rightreference,
155 Info info)
156 {
157 this.context = context;
158 this.leftreference = leftreference;
159 this.rightreference = rightreference;
160 this.info = info;
161 }
162
163
164
165
166
167
168 public void execute(EventHandler handler)
169 {
170 result = ((InvalidReferenceEventHandler) handler).invalidSetMethod(
171 context, leftreference, rightreference, info);
172 }
173
174 public Object getReturnValue()
175 {
176 return null;
177 }
178
179 public boolean isDone()
180 {
181 return result;
182 }
183
184 }
185
186
187
188
189 static class InvalidMethodExecutor implements EventHandlerMethodExecutor
190 {
191 private Context context;
192 private String reference;
193 private Object object;
194 private String method;
195 private Info info;
196
197 private Object result;
198 private boolean executed = false;
199
200 InvalidMethodExecutor(
201 Context context,
202 String reference,
203 Object object,
204 String method,
205 Info info)
206 {
207 this.context = context;
208 this.reference = reference;
209 this.object = object;
210 this.method = method;
211 this.info = info;
212 }
213
214
215
216
217
218
219 public void execute(EventHandler handler)
220 {
221 executed = true;
222 result = ((InvalidReferenceEventHandler) handler).invalidMethod(
223 context, reference, object, method, info);
224 }
225
226 public Object getReturnValue()
227 {
228 return result;
229 }
230
231 public boolean isDone()
232 {
233 return executed && (result != null);
234 }
235
236 }
237
238 }