Grails Plugin: Getting all command object classes

512 views Asked by At

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?

1

There are 1 answers

1
Jean Barmash On

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