Как получить .class определенной сущности Generics? [Дубликат]
This question already has an answer here:
Java - Generics with lists 5 answersИтак, как я могу сделать следующее в Java?
List<String> strings = new ArrayList<String>();
JAXBElement<List<String>> jax = new JAXBElement<List<String>>(new QName("strings"), List<String>.class, strings);
Проблема, в частности, возникает в List.class, и возвращается ошибка:
Multiple markers at this line
- List cannot be resolved to a variable
- String cannot be resolved to a variable
- Syntax error on token ">", void expected after this token