Assume I have a Java class MyClass
without type parameters, which (maybe indirectly) implements an interface MyInterface<T>
which does have a type parameter. We can conclude: Somewhere in the type hierarchy of MyClass
either a superclass or an interface must make that type parameter explicit. That information is available for reflection at runtime and, given enough free time, I could probably figure out at which point in the inheritance graph which (of the potentially many) variable(s) gets resolved where to which concrete type, and particular what T
is actually assigned to in MyClass
, but I don't want to reinvent the (square) wheel.
What common framework offers this functionality?
Aucun commentaire:
Enregistrer un commentaire