File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
EJB 3 in Action
this week in the
EJB and other Java EE Technologies
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
How To Ask Questions
How To Answer Questions
I agree. Here's the link:
subject: get class of type parameter
regarding objects and collections
regarding Objects and collections
JDBC Realm using Resource
What is wrong with the following code?
Iterating through unknown enum type variable
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014