30 Dezember 2011

Groovy is just wonderful. Check out the following Groovy listing. With Groovy you easily can implement dynamic method calls.

class WellThatIsGroovy {
    String name
    Date bar

def x = 'name'
def j = new WellThatIsGroovy(name : 'hzasdjkfhjk', bar: new Date())

println j."${x}"
println j.'bar'.format('dd.MM.yyyy HH:mm:ss')

Have a go with this script at the Groovy Web Console.

Tags: groovy