samedi 3 janvier 2015

Java reflection - checking method parameter type

I'm using this code in order to check a method parameters type and it doesn't seem to work.


Any ideas what am I not doing right?



Class<?>[] parameter_types = m.getParameterTypes();
if (parameter_types[0].equals(Integer.class)) {
//DO SOMETHING
}


m is a method with integer type parameter:



public void m(int param);





Aucun commentaire:

Enregistrer un commentaire