Let's suppose we have a type CustomMap<A, B>
which extends CommonMap<C, D>
which in turn implements Map<E, F>
.
Naturally one would expect that A == C == E
, but it's not always so - you can have a CustomMap<V>
implementing Map<String, V>
for example.
The question is, let's suppose I have a Field
, and field.getType()
is some interface or class implementing Map<K, V>
. The type itself may be non generic, may be generic but with generic signature differing from <K, V>
, etc. How go I get K
and V
type parameters of Map
using reflection?
Aucun commentaire:
Enregistrer un commentaire