|
1 |
| package com.agical.rmock.core.util; |
|
2 |
| |
|
3 |
| import com.agical.rmock.core.MethodHandle; |
|
4 |
| import com.agical.rmock.core.ProxyFactory; |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| public class InterfaceMethodHandle implements MethodHandle { |
|
13 |
| |
|
14 |
| private final Class returnType; |
|
15 |
| private final Class[] parameterTypes; |
|
16 |
| private final String objectId; |
|
17 |
| private final ProxyFactory proxyFactory; |
|
18 |
| private final String method; |
|
19 |
| private final DefaultValueProvider defaultValueProvider = new DefaultValueProvider(); |
|
20 |
| |
|
21 |
| |
|
22 |
| |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
2149
| public InterfaceMethodHandle(String objectId, String method, Class[] parameterTypes, Class returnType, ProxyFactory proxyFactory) {
|
|
27 |
2149
| this.objectId = objectId;
|
|
28 |
2149
| this.method = method;
|
|
29 |
2149
| this.parameterTypes = parameterTypes;
|
|
30 |
2149
| this.returnType = returnType;
|
|
31 |
2149
| this.proxyFactory = proxyFactory;
|
|
32 |
| } |
|
33 |
| |
|
34 |
| |
|
35 |
| |
|
36 |
| |
|
37 |
641
| public Class getReturnType() {
|
|
38 |
641
| return returnType;
|
|
39 |
| } |
|
40 |
| |
|
41 |
| |
|
42 |
| |
|
43 |
| |
|
44 |
1
| public Class[] getParameterTypes() {
|
|
45 |
1
| return parameterTypes;
|
|
46 |
| } |
|
47 |
| |
|
48 |
| |
|
49 |
| |
|
50 |
| |
|
51 |
661
| public Object invoke(Object[] args) throws Exception {
|
|
52 |
661
| return defaultValueProvider.getDefaultValue( returnType );
|
|
53 |
| } |
|
54 |
| } |