I am wondering if the Java gods out on SO have any tricks to share on how to make the following work
public class MyClass<T> {
public List<T> getMyList(Class1 a, String, b) {
Generic1<Generic2<T>, Class1> x = new Generic3<T>();
x.doSomething();
// this compiles but x doesn't work correctly since (of course) T is now type "Object"
}
}
//... calling it like this:
MyClass<MyType> c = new MyClass<>();
For object "x" above to do its job, it needs to know what the type for T is. Generic1, Generic2 and Generic3 are not classes that I wrote. But is there any way to convey the type information so they would work? Say, if I pass in the Class of the type at runtime?
Thanks.