Java generics are mostly compile time, this means that the type information is lost at runtime.
class GenericCls<T>
{
    T t;
}
will be compiled to something like
class GenericCls
{
   Object o;
}
To get the type information at runtime you have to add it as an argument of the ctor.
class GenericCls<T>
{
     private Class<T> type;
     public GenericCls(Class<T> cls)
     {
        type= cls;
     }
     Class<T> getType(){return type;}
}
Example:
GenericCls<?> instance = new GenericCls<String>(String.class);
assert instance.getType() == String.class;