In GWT, I have a generic Class<T>one in which I want to dynamically instantiate T:
class MyGenericClass<T> {
void foo(Class<T> clazz) {
...
T t = GWT.create(clazz);
}
}
But I have the following compilation error:
As arguments to GWT.create ()
only class literals can be used.
So how do I instantiate this class?
In another thread, I found:
GWT.create( Reflection.class ).instantiate( YourClass.class );
But I did not find a class named Reflectionwith this instantiation method.
source
share