In Scala, I can declare an object like so:
class Thing
object Thingy extends Thing
How would I get "Thingy"
(the name of the object) in Scala?
I've heard that Lift (the web framework for Scala) is capable of this.
Just get the class object and then its name.
scala> Thingy.getClass.getName
res1: java.lang.String = Thingy$
All that's left is to remove the $
.
EDIT:
To remove names of enclosing objects and the tailing $
it is sufficient to do
res1.split("\\$").last