开发者

Grails Plugin: Getting all command object classes

开发者 https://www.devze.com 2022-12-10 07:18 出处:网络
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 ge

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消