|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| package org.codehaus.wadi.group.impl; |
|
17 |
| |
|
18 |
| import java.lang.reflect.InvocationTargetException; |
|
19 |
| import java.lang.reflect.Method; |
|
20 |
| import org.codehaus.wadi.group.Dispatcher; |
|
21 |
| |
|
22 |
| |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
| abstract class AbstractMsgMethodDispatcher extends AbstractMsgDispatcher { |
|
27 |
| protected final Object _target; |
|
28 |
| protected final Method _method; |
|
29 |
| |
|
30 |
0
| public AbstractMsgMethodDispatcher(Dispatcher dispatcher, Object target, Method method, Class type) {
|
|
31 |
0
| super(dispatcher, type);
|
|
32 |
0
| _target = target;
|
|
33 |
0
| _method = method;
|
|
34 |
| } |
|
35 |
| |
|
36 |
0
| protected Object invoke(Object[] args) throws Exception {
|
|
37 |
0
| try {
|
|
38 |
0
| return _method.invoke(_target, args);
|
|
39 |
| } catch (InvocationTargetException e) { |
|
40 |
0
| Throwable cause = e.getCause();
|
|
41 |
0
| if (cause instanceof Runnable) {
|
|
42 |
0
| throw (RuntimeException) cause;
|
|
43 |
0
| } else if (cause instanceof Exception) {
|
|
44 |
0
| throw (Exception) cause;
|
|
45 |
| } else { |
|
46 |
0
| throw e;
|
|
47 |
| } |
|
48 |
| } |
|
49 |
| } |
|
50 |
| } |