dimanche 12 novembre 2017

How to get Enumeration package name with Scala Reflection?

I was able to get package name of a class in following way:

typeOf[Foo].typeSymbol.asClass.fullName
//returns com.example.Foo

The above works in case of Foo is regular class. However, the same don't work for Enumeration.

typeOf[FooEnum.Value].typeSymbol.asClass.fullName
//returns scala.Enumeration.Value

How can I achieve this?





Aucun commentaire:

Enregistrer un commentaire