Browsed by
Category: Groovy

First groovy experiences

First groovy experiences

Currently I’m staying at copenhagen at the GR8Conf (Grooy, Grails and Griffon confernence). In the talk of the day by Guillaume Laforge about DSLs he showed the following code: [sourcecode language=”groovy”] class CurrencyAmount { Number amount String currency String toString() { "$amount $currency" } } Number.metaClass.getEuros {-> new CurrencyAmount(amount:delegate, currency:"EUR")} 10.euros //Output: 10 EUR [/sourcecode] It is really interesting to see where in the java world the language evolvement happend. It’s a bit similiar (I’m careful here, because I do…

Read More Read More