List<String> list = new ArrayList<>(); TypeToken<List<String>> typeToken = new TypeToken<List<String>>() {}; TypeReference<List<String>> typeReference = new TypeReference<List<String>>() {}; Type listType = typeReference.getType(); public class MyType<T> extends TypeReference<T> { // ... } MyType<String> myType = new MyType<String>() {}; Type myGenericType = myType.getType(); - GenTyRef: A Generic Type Reflector Framework in Java [Online]. Available: https://github.com/moilioncircle/gen.tyref


上一篇:
下一篇:
切换中文