Wednesday, 28 August 2013

How to find the class name within a method

How to find the class name within a method

How can we get the name of the class inside a method in Groovy? For
example, given a class definition like below
class Foo {
def bar() {
// def className = <some magic>
// println className
}
}
the class name will be printed out with
new Foo().bar()

No comments:

Post a Comment