lundi 24 juillet 2017

Invoke method with parameters

I have a problem with reflection.

The very essence: there is a bunch of methods in the class. I find it necessary this way (it's all good here):

invokingMethod = InstanceClass.getMethod(AMethodName, AArgumentTypes);

Then I want to call him:

result = invokingMethod.invoke(AInstance, AArgumentObjects);

The number of parameters can be different. Here, simply calling the authorization method and therefore only two parameters Content AArgumentObjects:

enter image description here

And as a result I have an error about the wrong type of parameters passed.

Works only if you explicitly pass all parameters to a function. Or I use AArgumentObjects[1] in the debug menu variable (if I change it in the code, the errors remain):

enter image description here

After calling from the code with AArgumentObjects[1]:

Discharges : "java.lang.IllegalArgumentException"





Aucun commentaire:

Enregistrer un commentaire