samedi 1 août 2015

getMethod throws method not found exception

I am using the getMethod(String name, Class[] types) method to get a method but I get a method not found when there is an int parameter. I think I get that because inside my Class array I have the java.lang.Integer class (the wrapper) instead of int. I get that class by using a generic Object.getClass() so I don't think I can change that easily. Here is the part of the code that does this:

for (int i = 0; i < parameterTypes.length; i++) {
        parameterTypes[i] = arguments[i].getClass();
}

try {
    Method mmethod = mclass.getMethod(contractName, parameterTypes);
} catch (NoSuchMethodException e) {}

Can I solve this somehow?





Aucun commentaire:

Enregistrer un commentaire