public class Test<T>{ } Type genType = getClass().getGenericSuperclass(); Type[] params = ((ParameterizedType)genType).getActualTypeArguments(); Class fanType = (Class)params[0];
时间: 2024-12-17 11:11:38
public class Test<T>{ } Type genType = getClass().getGenericSuperclass(); Type[] params = ((ParameterizedType)genType).getActualTypeArguments(); Class fanType = (Class)params[0];