How to get class object of a generic interface?
For example, Boolean.class, Date.class.
But List<Boolean>.class doesn’t seem to be syntax-valid.
How to get class object of a generic interface? For example, Boolean.class, Date.class. But
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Just write
List.class.List<Boolean>is not of a different type, at runtime. The generic type only exists at compile time. So this imaginaryList<Boolean>.classwould not exist to be used in your program.There is no way to programmatically access the generic type, since it is not present in the byte code. It is only to help the compiler.