I have a method like that:
public void get(Date date)
And I get it use reflection, and I want to check the type of parameter, make sure whether it is a type of java.util.Date, I do it like that:
Class<?> parametersType = method.getParameterTypes();
// check it
if (parametersType[].equals(java.util.Date.class))
{
// do something
}
I want to know, are there any other way?
Aucun commentaire:
Enregistrer un commentaire