-4

I know that I can do this:

Class<T> type = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];

But how can I create a class based on this new type?

Class<MyObject<T>> type = ???;

thanks

1 Answers1

0
Class<MyObject<T>> type = (Class<MyObject<T>>)(Class<?>)MyObject.class;
newacct
  • 119,665
  • 29
  • 163
  • 224