Is it possible to get .class from a generic class?
How does one do something like:
Schema<ArrayList<UnitInstanceData>> scheme开发者_JS百科 =
RuntimeSchema.getSchema(ArrayList<UnitInstanceData>.class));
The .class is runtime access to the class object. At runtime generics are gone, having been eliminated by "type erasure". In your example, all you can get is ArrayList.class. If you need to know the type of the generic class at runtime you must pass a second parameter, as in
RuntimeSchema.getSchema(ArrayList.class, UnitInstanceData.class));
加载中,请稍侯......
精彩评论