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: Design Pattern
04-Oct-2011