Java运行时获得参数类型
class A<T> { Class<T> specializedClass; public A() { this.specializedClass = (Class<T>) ((ParameterizedType) this.getClass() .getGenericSuperclass()).getActualTypeArguments()[0]; } }
Java运行时获得参数类型
class A<T> { Class<T> specializedClass; public A() { this.specializedClass = (Class<T>) ((ParameterizedType) this.getClass() .getGenericSuperclass()).getActualTypeArguments()[0]; } }