|
1 |
| package com.agical.rmock.core.util; |
|
2 |
| |
|
3 |
| import net.sf.cglib.proxy.MethodProxy; |
|
4 |
| |
|
5 |
| import com.agical.rmock.core.MethodHandle; |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| public class ForwardingMethodHandle implements MethodHandle { |
|
14 |
| |
|
15 |
| private final String objectId; |
|
16 |
| private final String method; |
|
17 |
| private final Class[] parameterTypes; |
|
18 |
| private final Class returnType; |
|
19 |
| private final Object proxy; |
|
20 |
| private final MethodProxy methodProxy; |
|
21 |
| |
|
22 |
1193
| public ForwardingMethodHandle(Object proxy, MethodProxy methodProxy, String objectId, String method, Class[] parameterTypes, Class returnType) {
|
|
23 |
1193
| this.proxy = proxy;
|
|
24 |
1193
| this.methodProxy = methodProxy;
|
|
25 |
1193
| this.objectId = objectId;
|
|
26 |
1193
| this.method = method;
|
|
27 |
1193
| this.parameterTypes = parameterTypes;
|
|
28 |
1193
| this.returnType = returnType;
|
|
29 |
| } |
|
30 |
| |
|
31 |
80
| public Class getReturnType() {
|
|
32 |
80
| return returnType;
|
|
33 |
| } |
|
34 |
| |
|
35 |
1
| public Class[] getParameterTypes() {
|
|
36 |
1
| return parameterTypes;
|
|
37 |
| } |
|
38 |
| |
|
39 |
1017
| public Object invoke(Object[] args) throws Throwable {
|
|
40 |
1017
| return methodProxy.invokeSuper( proxy, args );
|
|
41 |
| } |
|
42 |
| } |