0
Would someone like to tell me how I pass the value of a parameter through the "invoke" method in Java?
I have a method that takes as parameter a String (This is the method I want to invoke).
However I am using a generic method that takes as parameter a class, and returns a String.
Briefly, I’m doing this:
Method mt = classe.getMethod("getSQL");
Object invoke = mt.invoke(classe, filtro);
The parameter "class" is the class from which I want to find the method, and the "filter" is the parameter I would like to send to the method I want to invoke.
However I am getting the following error:
java.lang.NoSuchMethodException: br.com.viasoft.orion.model.evolucaovendas.EvolucaoVendas.getSQL()
If anyone can help, I’m grateful.
https://www.baeldung.com/java-method-reflection
– Reginaldo Rigo
Ball show the material, helped here. VLW!!
– GUSTAVO HENRIQUE LOPES SPACHUK
Check method name in class?
– Ivan Silva
Yes, the problem was juxtaposing the parameter, because before when I had no parameter, I could without any problems. But now it worked, vlw
– GUSTAVO HENRIQUE LOPES SPACHUK