mardi 2 juin 2015

Java Reflection, extract generic type from method

I have a java method with the following signature:

static <ContentType> Map<Object,ContentType> foo();

I want to use reflection to dynamically change the behavior of the method according to ContentType. To achieve this, I must be able to handle ContentType as an object (maybe an instance of java.lang.reflect.Type). Does anyone know how to do this? Is that event possible?





Aucun commentaire:

Enregistrer un commentaire