完善Rest的泛型识别
This commit is contained in:
@@ -1158,7 +1158,8 @@ public final class Rest {
|
|||||||
}
|
}
|
||||||
} while ((loop = loop.getSuperclass()) != Object.class);
|
} while ((loop = loop.getSuperclass()) != Object.class);
|
||||||
}
|
}
|
||||||
paramlist.add(new Object[]{param, n, ptype, radix, comment, required, annpara, annsid, annaddr, annhead, anncookie, annbody, annfile, annuri, userid, annheaders, param.getParameterizedType()});
|
java.lang.reflect.Type paramtype = TypeToken.getGenericType( param.getParameterizedType(),serviceType);
|
||||||
|
paramlist.add(new Object[]{param, n, ptype, radix, comment, required, annpara, annsid, annaddr, annhead, anncookie, annbody, annfile, annuri, userid, annheaders, paramtype});
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Object> mappingMap = new LinkedHashMap<>();
|
Map<String, Object> mappingMap = new LinkedHashMap<>();
|
||||||
|
|||||||
@@ -151,6 +151,7 @@ public abstract class TypeToken<T> {
|
|||||||
ss = ss.getSuperclass();
|
ss = ss.getSuperclass();
|
||||||
asts = ss.getTypeParameters();
|
asts = ss.getTypeParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (atas.length == asts.length) {
|
if (atas.length == asts.length) {
|
||||||
for (int i = 0; i < asts.length; i++) {
|
for (int i = 0; i < asts.length; i++) {
|
||||||
Type currt = asts[i];
|
Type currt = asts[i];
|
||||||
@@ -185,6 +186,14 @@ public abstract class TypeToken<T> {
|
|||||||
&& ((TypeVariable) type).getBounds()[0] instanceof Class
|
&& ((TypeVariable) type).getBounds()[0] instanceof Class
|
||||||
&& ((Class) ((TypeVariable) type).getBounds()[0]).isAssignableFrom((Class) atas[i]))
|
&& ((Class) ((TypeVariable) type).getBounds()[0]).isAssignableFrom((Class) atas[i]))
|
||||||
return atas[i];
|
return atas[i];
|
||||||
|
if (atas[i] instanceof Class
|
||||||
|
&& ((TypeVariable) type).getBounds().length == 1
|
||||||
|
&& ((TypeVariable) type).getBounds()[0] instanceof ParameterizedType) {
|
||||||
|
ParameterizedType pt = (ParameterizedType) ((TypeVariable) type).getBounds()[0];
|
||||||
|
if (pt.getRawType() instanceof Class && ((Class) pt.getRawType()).isAssignableFrom((Class) atas[i])) {
|
||||||
|
return atas[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
if (atas[i] instanceof ParameterizedType
|
if (atas[i] instanceof ParameterizedType
|
||||||
&& ((TypeVariable) type).getBounds().length == 1
|
&& ((TypeVariable) type).getBounds().length == 1
|
||||||
&& ((TypeVariable) type).getBounds()[0] == Object.class)
|
&& ((TypeVariable) type).getBounds()[0] == Object.class)
|
||||||
|
|||||||
Reference in New Issue
Block a user