Posted on

TIL: Grails Exapndo Object

TIL: On our development team, someone used POGO’s to define a payload to a REST API.

Were coming from a JavaScript perspective, having every object be dynamic, there is no need to define any structure before hand.
So I started googling dynamic objects information for Grails.

I found a great slideshare on it that explains how the Expando object, utilizes metaprogramming techniques, to create a dynamic class.
While in some languages you may find a keyword usually ‘dynamic’ which makes the object flexible at run time, in grails you have to declare and Expando object, or inherit form it.

Its mentioned on the bottom of this page here:
http://groovy.codehaus.org/Collections