I use some nested classes like List, MyObject ...
Then I can find the type of them with using:
Type type = new com.google.gson.reflect.TypeToken<List<String>>() {}.getType();
But when I try to handle it with generic types like:
public static <T> T findClass(Class<T> resultClass)
{
//E.g. resultClass = String.class; Expect: List<String>
Type type = new com.google.gson.reflect.TypeToken<List<T>>() {}.getType();
}
It doesn't work for me.
In here, I wonder two things.
- Can I fix this problem?
- Can I describe a path like Class> in java?
Aucun commentaire:
Enregistrer un commentaire