0

I have the class like this:

public class GsonRequest<T> extends Request<T>{
...
    private final Type typeInfo = new TypeToken<List<T>>() {}.getType();
}

The typeInfo is the same as new TypeToken<List>() {}.getType() because T is not usable at runtime.

Now I would like to pass the class info by constructor parameter:

public class GsonRequest<T> extends Request<T> {
    private final Type typeInfo;

    GsonRequest(Class<?> c){
         //how to create a type info which equals 
         //new TypeToken<List<C>>() {}.getType() here?
    }
}

So,how to crete type info by this way?

user2219372
  • 2,385
  • 5
  • 23
  • 26

0 Answers0