score:0

Figured it out.

Just needed to use m.typeSignature

for (m <- typeOf[Account].members.filter(m => !m.isMethod)) {
     | println(m)
     | println(m.typeSignature)
     | }
variable accountNumber
String
variable name
String

score:8

You can use typeSignature:

scala> typeOf[Account].members.filter(!_.isMethod).foreach(
 |   sym => println(sym + " is a " + sym.typeSignature)
 | )
variable accountNumber is a String
variable name is a String

In this context this method will return a reflect.runtime.universe.Type.


Related Query

More Query from same tag