hibernate get方法 class 泛型怎么做

2024-11-28 11:28:13
推荐回答(1个)
回答1:

Type genType = clazz.getGenericSuperclass(); Type [] params = ((ParameterizedType) genType).getActualTypeArguments(); return (Class) params[0]; 泛型反射的关键是获取ParameterizedType,再调用它的getActualTypeArguments()方法获得实