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