I have the below function, I am trying to assign a value to the generic variable obj. And getting error: "Expression of type string cannot firm to expected type A". How do I fix this, any pointers would help, thanks.
def getTypedData[A](name: String, typeName: String): DataPoint[A] = {
var obj: A = null.asInstanceOf[A]
typeName match {
case "string" => obj = Random.nextString(5)
}
DataPoint(name, obj)
}