A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
get class of type parameter
Joined: Jun 28, 2008
Jul 06, 2009 01:02:59
I have something like this:
and while running the programm the
can be a type of (for example) the object
How can I get the class of the type parameter (which, in this case, can only be Users or Persons)?
Class x = MyObjects.getClazz().getTypeParameters() ??
Joined: Oct 27, 2005
Jul 06, 2009 01:31:18
You can't, unfortunately. This information is removed by the compiler. This is called type erasure.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions
How To Answer Questions
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: get class of type parameter
Iterating through unknown enum type variable
JDBC Realm using Resource
regarding Objects and collections
regarding objects and collections
What is wrong with the following code?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015