Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
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
Class<MyObject<T>> type = (Class<MyObject<T>>)(Class<?>)MyObject.class;