Is there any way I can create a method in scala from a string and then invoke it? For example
val code = "(a: String, b:String) => {a+b}"
I would like to know if there is any way to instantiate the method and invoke it?
I have explored toolbox and twitter util eval both of them requires me to compile and instantiate the method asInstanceOf[(String, String) => Option[Any]]
To do this I need to know the arguments and their types, I am looking for way in which I don't need to know the argument types before hand.
Aucun commentaire:
Enregistrer un commentaire