views:

117

answers:

1

In a plugin, I need to iterate over all domain and command object classes to apply some meta-magic to them. Getting the domain classes isn't a problem, however command objects are not that easy to get hold of, since they don't seem to be considered Grails artefacts. After browsing the docs, I came up with the following code:

def doWithDynamicMethods = { ctx ->
    application.controllerClasses.each {
        it.commandObjectClasses.each {
            // do something
        }
    }
}

This seems to work, however it doesn't include the command objects that are used inside webflow actions. Is this a bug or is my approach wrong?

A: 

I don't believe commandObjects are true domainObjects. You could use the Artefact API to register them and to find them.

Jean Barmash
Yes, I know that command objects are not domain classes and thus they are not included in `application.domainClasses`. That's why I'm looking for a way to get hold of the command objects. As to the Artefact API: To register the command objects as artefacts, I would still have to find all command objects in the first place (to be able to register them)...
Daniel Rinser