quarks
quarks

Reputation: 35276

Get generic type class during runtime

I've been trying to figure out how to determinate the classname of a generic type at runtime, but maybe I need to rephrase my thinking regarding this.

For example I have:

Map<String,Integer> map = new PersistentHashMap<String,Integer>();

Will I be able to retrieve the classnames java.lang.String and java.lang.Integer from the PersistentHashMap for example?

Upvotes: 0

Views: 67

Answers (1)

SLaks
SLaks

Reputation: 887423

Due to type erasure, this is not possible.

Upvotes: 5

Related Questions