Share

From this page you can share I Want My Type Information (Back) to a social bookmarking site or email a link to the page.
Social WebE-mail
Enter multiple addresses on separate lines or separate them with commas.
I Want My Type Information (Back)
(Your Name) has forwarded a page to you from Ajaxonomy
(Your Name) thought you would like to see this page from the Ajaxonomy web site.

I Want My Type Information (Back)

Tagged:  

As Neal Gafter explained a while ago, there is a backdoor in Java's generic type erasure:

getClass().getGenericSuperclass()

Google Guice makes use of this backdoor to enable the construction of a generic type literal (or Super Type Token): its TypeLiteral class. Now (the soon to be released) Guice 2.0 goes a step further: it can inject a TypeLiteral into your class, thereby reifying your generic types (well, sort of). All the details of the changes to com.google.inject.InjectorImpl are here.

As Neal Gafter also explained, java.lang.reflect.Type really should be retrofitted. Until then, Guice offers you a little help.