Abstract
This chapter explains what Groovy Objects is for, and a little about how it works.
The Naked Objects framework enables design-driven applications to be rapidly developed and optionally deployed, automatically providing a runtime-generated OOUI for the domain objects. Naked Objects is written in Java, and normally the domain objects that make up the application are also written in Java. These objects are basically pojos; Naked Objects provides a number of annotations and defines a number of coding conventions so that business rules and constraints can be picked up by the framework, and to expose behaviour in the UI over-and-above simple CRUD operations.
Naked Objects performs its magic by building a metamodel of the underlying domain objects, and uses this to build the OOUI. The process is very similar to the way that ORMs such as Hibernate work, but rather than reflecting the domain objects into the persistence layer, it reflects them into the presentation layer.
Groovy (as I'm sure you know) is an alternative language for writing code to run on the JVM. It offers a number of dynamic language features, as well reduced syntax clutter (eg for properties) along with programming constructs such as closures.
What Groovy Objects provides is the ability to write domain objects in Groovy and then run on top within Naked Objects. Because Groovy source files are ultimately compiled down into Java bytecode, Naked Objects is able (with a little bit of tweaking) to build up its metamodel and run as normal. What Groovy Objects does is perform the tweaking in how the metamodel is built up.
This user guide explains how to configure your project to develop using Groovy, and provides some guidance on how to follow the Naked Objects coding conventions while programming in Groovy. We generally recommend you develop your domain applications using Apache Maven, and Groovy Objects itself is packaged as a Maven module. The details provided focus solely on how to update a Maven-based project; we also explain how to configure your application within an IDE.