I need to get only field names of case class. I\'m not interested in its values.
I thought getClass.getDeclaredFields.map(_.getName) would return a list of fiel
Starting Scala 2.13, case classes (which are an implementation of Product) are now provided with a productElementNames method which returns an iterator over their field's names.
From an instance of the case class (let's say case class Person(name: String, age: Int)), one can retrieve a List of its fields:
Person("hello", 28).productElementNames.toList
// List[String] = List(name, age)