I have a method with signature
<T extends AbstractClass> T method(Class<T> abstractClass)
and I cannot modify the signature.
Also I have a string with class name com.test.MyClass. Is it possible to create a class by class name to pass to my method?
Something like that
Class<? extends AbstractClass> clz = (Class<? extends AbstractClass>) Class.forName(classNameStr);
String. She is asking how to call the given method so it returns an object of the class for which she only has the class name as aString. That's my understanding anyway.AbstractClass obj = method((Class<? extends AbstractClass>) Class.forName("com.test.MyClass"));