Grails Plugin: Getting all command object classes
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 开发者_如何学Cof, 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?
I don't believe commandObjects are true domainObjects. You could use the Artefact API to register them and to find them.
精彩评论