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
User.getClass does not give you the equivalent of User.class in Java, but it gives you the class of the companion object of the User class. You can retrieve the Class object of User with classOf[User].
edit: Oh and the User$.MODULE$ is an accessor to the singleton instance that is used internally. Think of it as the equivalent to MyClass.INSTANCE when you are writing singletons in Java.