mercredi 20 juillet 2016

how to extract A from typeA (val typeA = typeOf[A])?

there is a case class and a Type variable:

case class A()
val typeA = typeOf[A]
fun(typeA)

and there is a function:

def fun(t: Type){  
    // how to use 't' to create List[A]
    val l = List[/*convert 't' to A type*/]()
}

how to do?





Aucun commentaire:

Enregistrer un commentaire