Duplicate :
|
A DESCRIPTION OF THE REQUEST : When writing a class that supports generics, I'd like to be retrieve a handle to the Class reference for my generalized type. This should be possible by calling T.class (where T is my type identifier), but the compiler doesn't allow this. JUSTIFICATION : In my case, I need to call getEnumConstants() on class to get all of the declared enumeration values in an enum class. Other implementations might be interested in having the class for using reflection or logging class information. CUSTOMER SUBMITTED WORKAROUND : Currently, the best workaround is to create a constructor with an argument of Class<T>.