vendredi 1 septembre 2017

Passing variable / reference as type to generic function in scala

val runtimeclasString="java.lang.String"
val className=Class.forName(runtimeclassString)
val classTagref=ClassTag(className)
anyFunctio[String,classTagref]()

Method Signature: def anyFuntion[A:ClassTag,B:ClassTag]()={}

anyFunction[String,classTagref 'not wrking' ]()

So if i set any class Name at runtime i can able to send that class type to my function. But it is not working any solution?





Aucun commentaire:

Enregistrer un commentaire