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?
>` should be `T`?
– Andy Turner Jan 25 '15 at 00:36