mardi 3 novembre 2020

Java Reflection in Scala, Error in Passing parameters to function

I am using Java Reflection in Scala, However when I try to invoke the function I am getting the following Error : java.lang.IllegalArgumentException: argument type mismatch

Following function present in testClass

 def test(mystr:String):String ={
    return "hi"
  }

I am calling the above function the following way

 var params = new Array[Object](1)
 params(0) = "hi"

//extractOject is instance of testClass
 val featuresJsonStr = extractFunction.invoke(extractOject,params)

I read that invoke function expects parameters of function as array of objects, I am trying to do the same thing here





Aucun commentaire:

Enregistrer un commentaire