-
Book Overview & Buying
-
Table Of Contents
Grails 1.1 Web Application Development
By :
When we installed the Searchable plug-in to make a domain class searchable, we added a static property ( static searchable = true) to the domain class and it became searchable. This approach is possible in Groovy and Grails because Groovy allows methods and properties to be added to classes at run-time. The Grails plug-in architecture provides hooks into the lifecycle of a plug-in so that dynamic behavior can be added on startup.
The goal for the rest of this chapter is to convert the Taggable plug-in so that domain classes can be made taggable by defining the property (static taggable = true). You will achieve this through dynamically adding methods to domain classes at runtime.
Before moving on to the implementation details it is worth having a brief look at the lifecycle events that are made available by the Grails plug-in architecture.
There are two types of lifecycle events that are available to Grails plug-ins:
Build events
Runtime events...
Change the font size
Change margin width
Change background colour