When it comes to classes without generics, i can access this .class attribute like this:
class Foo{
Class<Foo> getMyClass(){
return Foo.class;
}
}
but how do i access this ".class" attribute if Foo has a generic? like this:
class Foo<T>{
Class<Foo<T>> getMyClass(){
return (Foo<T>).class //this doesnt work...
}
}
i have tried to return Foo.class
, but this is not going to work: "cannot cast from Class<Foo> to Class<Foo<T>>"
.
How can i access Foo<T>
's class?