No, this is not possible.
You cannot get something like T.class
, because generics are erased at runtime. You really need to pass in Class<T>
to be able to get the class itself.
I also smell an XY-problem. Perhaps you really need the class type, but without further information, this smells a little bit.