Get a class name with generics information

Posted by Damien on Stack Overflow See other posts from Stack Overflow or by Damien
Published on 2010-04-13T14:51:20Z Indexed on 2010/04/13 14:52 UTC
Read the original article Hit count: 409

Filed under:
|
|

Hello, In a java serialization problem, I want to save some classes name and I have some problems with generic classes. For example :
- If I have ArrayList<String> listToDump = new ArrayList<String>();
- If I take the name : listToDump.getName(); or listToDump.getCanonicalName();
- I will have java.util.ArrayList or ArrayList
- And I want to have java.util.ArrayList<String> or ArrayList<String>

Any ideas on how I can do this? Damien.

© Stack Overflow or respective owner

Related posts about java

Related posts about generics