I have a generic class that I need to return complete type info for, and I have the class information for the generic parameter type. How might I upgrade the class information for the generic type parameter?
public class MyClass<T> {
String key;
T value;
Class<MyClass> getTypeInfo(Class<T> cls) {
// How do I upgrade this with the reified type info in cls?
return MyClass.class;
}
}
Ultimately, I'm writing a deserialization schema for Flink, and Need to return a reified class information in getProducedType as part of the interface. The class returned by the deserializer is a something like MyClass where I know the class information of T.
https://www.logicbig.com/how-to/code-snippets/jcode-reflection-class-gettypeparameters.html
Aucun commentaire:
Enregistrer un commentaire