jeudi 16 février 2017

How to get manifest from string representation

There is a way for get class by name, for example Class.forName("com.project.model.User").

Is it possible to get manifest from string representation? For example, there are two situations:

Get manifest from type-name without type parameters

val str = "com.project.model.User"

val mf: Manifest[User] = howToGetManifestByName(str)  // ???

Get manifest from type-name with type parameters

val str = "com.project.model.List[Int]"

val mf: Manifest[List[Int]] = howToGetManifestByName(str)  // ???

environment: scala-2.11.8





Aucun commentaire:

Enregistrer un commentaire