2016-05-18 63 views

回答

1

這是在Grails的3更容易一點(和Grails 2,如果你只使用動作的方法也沒有關閉):

import grails.web.Action 

def data = grailsApplication.controllerClasses.collect { controller -> 
    [controller: controller.logicalPropertyName, 
    controllerName: controller.fullName, 
    actions: controller.clazz.methods.findAll { it.getAnnotation(Action) }*.name.sort()] 
} 
+0

「和Grails 2,如果你只使用動作的方法,沒有倒閉潮」 - 我不要以爲你必須排除使用閉包進行操作的應用程序。你上面展示的代碼也適用於這些,因爲框架在編譯時在Grails 2中生成相應的方法。 –

相關問題