public static Type getInheritGenericType(Class<?> clazz, TypeVariable<?> tv) {
Type type = null;
GenericDeclaration gd = tv.getGenericDeclaration();
do {
type = clazz.getGenericSuperclass();
if (type == null) {
return null;
}
if (type instanceof ParameterizedType) {
ParameterizedType ptype = (ParameterizedType) type;
if (ptype.getRawType() == gd) {
TypeVariable<?>[] tvs = gd.getTypeParameters();
Type[] types = ptype.getActualTypeArguments();
for (int i = 0; i < tvs.length; i++) {
if (tvs[i] == tv) return types[i];
}
return null;
}
}
clazz = TypeUtils.getClass(type);
} while (type != null);
return null;
}
FieldInfo.java 文件源码
java
阅读 53
收藏 0
点赞 0
评论 0
项目:uavstack
作者:
评论列表
文章目录