Finally, we need to update the commandline
and/or webapp project (depending on how you intend
to bootstrap your application). First, we add a dependency to
Groovy Objects' gmetamodel
module, in <dependencies>
:
<dependencies> ... <dependency> <groupId>org.starobjects.groovy</groupId> <artifactId>gmetamodel</artifactId> </dependency> ... </dependencies>
Then, update the nakedobjects.properties
config file as follows:
nakedobjects.reflector.facets.include=org.starobjects.groovy.gmetamodel.RemoveGroovyMethodsFacetFactory
This little piece of magic alters the way that Naked Objects builds up its metamodel of the domain objects. Specifically what it does is to filter out the various methods that the Groovy compiler adds behind the scenes.
In most circumstances that should be enough. If you have very deep hierarchies of domain classes, then you may also need to add in:
starobjects.groovy.depth=NNN
where NNN should be the depth of the class hierarchy. The default is 5, so in many cases there won't be any need to add this key. (The reason this is needed is that the Groovy compiler seems to generate a set of methods for each level of the class hierarchy).
And you should be good to go.