Class Model{ private T t; ..... private void someMethod(){ //now t is null Class c = t.getClass(); } ..... }
It's not possible due to type erasure.
There is the following workaround:
class Model { private T t; private Class tag; public Model(Class tag) { this.tag = tag; } private void someMethod(){ // use tag } }