Grails, Technology

Closure Delegate using Groovy “with” Method and decorating code with multiple assignments

Groovy is an expressive language, that is what we are going to talk about making the usage of "with" method for specifying closure delegate and making our code more succinct (brief and clearly expressed). In my recent project, I was writing a code to resolve tenant and setting some properties to object tenant. ...

by Tarun Pareek
Tag: closure
23-Jul-2015

Grails

Closure as an implementation to interface

Recently, I saw some code of grails Hibernate Plugin and noticed an interesting usage of 'as' operator. The 'as' operator of groovy is typically used to change the types of objects. For example: [groovy] int a = "20" as int assert a==20 [/groovy] The 'as' operator can be used to provide implementation to interface as...

by Mohd Farid
Tag: closure
04-Oct-2011