'utilize Class<T extends baseClass> in a method parameter

I have a method whose signature is:

<T> T fromJson(String json, Class<? extends BaseClass> extendedClass)

The goal of the method is to to convert json into a rest class, but that rest class must extend a certain base class. I was wondering if in Java, you could change the "?" mark to a "T" instead, so it would read:

<T> T fromJson(String json, Class<T extends BaseClass> extendedClass)

However, this code does not compile. The exception in the compiler is unexpected bound, and the build output is: "> expected". Is there another way to do this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source