16
16
*/
17
17
package org .apache .dubbo .rpc .protocol .dubbo .telnet ;
18
18
19
+ import com .alibaba .fastjson .JSON ;
20
+ import com .alibaba .fastjson .JSONObject ;
19
21
import org .apache .dubbo .common .extension .Activate ;
20
22
import org .apache .dubbo .common .utils .ReflectUtils ;
21
23
import org .apache .dubbo .common .utils .StringUtils ;
27
29
import org .apache .dubbo .rpc .model .ProviderMethodModel ;
28
30
import org .apache .dubbo .rpc .model .ProviderModel ;
29
31
30
- import com .alibaba .fastjson .JSON ;
31
- import com .alibaba .fastjson .JSONObject ;
32
-
33
32
import java .lang .reflect .Method ;
34
33
import java .util .ArrayList ;
35
34
import java .util .Collection ;
36
35
import java .util .List ;
37
- import java .util .Map ;
38
36
39
37
import static org .apache .dubbo .common .utils .PojoUtils .realize ;
40
38
import static org .apache .dubbo .rpc .RpcContext .getContext ;
@@ -50,19 +48,19 @@ private static Method findMethod(List<ProviderMethodModel> methods, String metho
50
48
Class <?>[] paramTypes ) {
51
49
for (ProviderMethodModel model : methods ) {
52
50
Method m = model .getMethod ();
53
- if (isMatch (m , args , paramTypes ,method )) {
51
+ if (isMatch (m , args , paramTypes , method )) {
54
52
return m ;
55
53
}
56
54
}
57
55
return null ;
58
56
}
59
57
60
- private static boolean isMatch (Method method ,List <Object > args , Class <?>[] paramClasses ,String lookupMethodName ) {
61
- if (!method .getName ().equals (lookupMethodName )) {
58
+ private static boolean isMatch (Method method , List <Object > args , Class <?>[] paramClasses , String lookupMethodName ) {
59
+ if (!method .getName ().equals (lookupMethodName )) {
62
60
return false ;
63
61
}
64
62
65
- Class <?> types []= method .getParameterTypes ();
63
+ Class <?> types [] = method .getParameterTypes ();
66
64
if (types .length != args .size ()) {
67
65
return false ;
68
66
}
@@ -99,13 +97,10 @@ private static boolean isMatch(Method method,List<Object> args, Class<?>[] param
99
97
if (!ReflectUtils .isCompatible (type , arg )) {
100
98
return false ;
101
99
}
102
- } else if (arg instanceof Map ) {
103
- String name = (String ) ((Map <?, ?>) arg ).get ("class" );
104
- Class <?> cls = arg .getClass ();
105
- if (name != null && name .length () > 0 ) {
106
- cls = ReflectUtils .forName (name );
107
- }
108
- if (!type .isAssignableFrom (cls )) {
100
+ } else if (arg instanceof JSONObject ) {
101
+ try {
102
+ ((JSONObject ) arg ).toJavaObject (type );
103
+ } catch (Exception ex ) {
109
104
return false ;
110
105
}
111
106
} else if (arg instanceof Collection ) {
0 commit comments