This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

get class of type parameter  RSS feed

 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have something like this:



and while running the programm the ? can be a type of (for example) the object Users or Persons:



How can I get the class of the type parameter (which, in this case, can only be Users or Persons)?

something like;



 
Rob Spoor
Sheriff
Posts: 21047
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't, unfortunately. This information is removed by the compiler. This is called type erasure.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!